Creates a function that returns the value at path of a given object.
path
The path of the property to get.
Optional
The fallback value in case of not finding the value of the desired property.
The new accessor function.
1.0.0
const fn = property("foo"); // => (value) => get(value, "foo");fn({ foo: "bar" }); // => "bar" Copy
const fn = property("foo"); // => (value) => get(value, "foo");fn({ foo: "bar" }); // => "bar"
const fn = property("foo.bar", 0); // => (value) => get(value, "foo.bar", 0);fn({ foo: "bar" }); // => 0 Copy
const fn = property("foo.bar", 0); // => (value) => get(value, "foo.bar", 0);fn({ foo: "bar" }); // => 0
Creates a function that returns the value at
path
of a given object.