uinix-fp
object prop utility.
This package is ESM-only and requires Node 12+.
npm install uinix-fp-prop
prop
is a curried function returning the value of the specified object property.
import {prop} from 'uinix-fp-prop';
const user = {
firstName: 'Jesse',
lastName: 'Pinkman',
};
prop('firstName')(user); // 'Jesse'
prop('lastName')(user); // 'Pinkman'
prop('age')(user); // undefined
const propFirstName = prop('firstName'); // curried
[user, user, user].map(propFirstName); ['Jesse', 'Jesse', 'Jesse'];
This package exports the following identifiers: prop
. There is no default export.
-
property
(string
) — An object property. -
object
(object
) — The provided object.
-
any
— The object value for the specified property.