Library API
    Preparing search index...

    Function delegator

    • Creates a virtual Proxy where fixed keys are mapped to a callback function.

      Type Parameters

      • K extends string | symbol

      Parameters

      • keys: Record<K, any> | K[]

        The array of allowed keys (or an object whose ownKeys will be used)

      • fn: (prop: K) => any

        The callback fired when a key is accessed

      Returns Record<K, any>

      The virtual delegator object

      const v = delegator(['a', 'b'], (key) => key.toUpperCase());