Skip to main content

prop()

const prop: <T>(obj) => <K>(prop) => T[K] = property

Gets the value of prop in obj. Array index support.

Gets the value of prop in obj. Array index support.

Type Parameters

T

T extends object

The type of the input object.

Parameters

obj

T

The object to get the value from.

Returns

<K>(prop): T[K]

Type Parameters

K

K extends string | number | symbol

Parameters

prop

K

Returns

T[K]

Remarks

pure function

Example

property(personStore)('address');
// personStore.address

property(userStore.profile)(0);
// userStore.profile.at(0)

Remarks

pure function