getter

Can be used for getting value from object using field path. For example users[index].name.

const values = {users:[{lastName: 'Doe'}]};
const firstUserLastName = getter('user[0].lastName');

console.log(firstUserLastName(values))

// result: 'Doe'

Parameters

field string

Returns

(values: any) => any