uinix-fp-prop
v1.0.0
Published
uinix fp object prop utility
Downloads
4
Readme
uinix-fp-prop
uinix-fp
object prop utility.
Install
This package is ESM-only and requires Node 12+.
npm install uinix-fp-prop
Use
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'];
API
This package exports the following identifiers: prop
. There is no default export.
prop(property)(object)
Parameters (Curried)
property
(string
) — An object property.object
(object
) — The provided object.
Returns
any
— The object value for the specified property.