@extremejs/utils - v1.0.0-beta.23
    Preparing search index...

    Function iteratee

    • Creates a function that invokes fn with the arguments of the created function. If fn is a property name, the created function returns the property value for a given element.

      Type Parameters

      • Iteratee extends string | IterateeFnT<any, any>
      • Fallback = undefined

      Parameters

      • fn: Iteratee

        The value to convert to a callback.

      • Optionalfallback: Iteratee extends PropertyKey ? Fallback : never

        The fallback value to use, in case of fn being a property name.

      Returns Iteratee extends PropertyKey ? PropertyAccessorT<Iteratee, Fallback> : Iteratee

      The callback.

      1.0.0

      const callback = iteratee("foo"); // => (value) => get(value, "foo");

      callback({ foo: "bar" }); // => "bar"
      const callback = iteratee((foo: { bar: string }) => foo.bar); // => (foo: { bar: string }) => foo.bar;

      callback({ bar: "baz" }); // => "baz"