uinix-fp-prop
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

uinix-fp-prop

Build Coverage Downloads Size

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.

License

MIT © Chris Zhou

Readme

Keywords

Package Sidebar

Install

npm i uinix-fp-prop

Weekly Downloads

3

Version

1.0.0

License

MIT

Unpacked Size

3.19 kB

Total Files

4

Last publish

Collaborators

  • chrisrzhou