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.
fn
The value to convert to a callback.
Optional
The fallback value to use, in case of fn being a property name.
The callback.
1.0.0
const callback = iteratee("foo"); // => (value) => get(value, "foo");callback({ foo: "bar" }); // => "bar" Copy
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" Copy
const callback = iteratee((foo: { bar: string }) => foo.bar); // => (foo: { bar: string }) => foo.bar;callback({ bar: "baz" }); // => "baz"
Creates a function that invokes
fnwith the arguments of the created function. Iffnis a property name, the created function returns the property value for a given element.