- Lodash Tutorial
- Lodash - Home
- Lodash - Overview
- Lodash - Environment Setup
- Lodash - Array
- Lodash - Collection
- Lodash - Date
- Lodash - Function
- Lodash - Lang
- Lodash - Math
- Lodash - Number
- Lodash - Object
- Lodash - Seq
- Lodash - String
- Lodash - Util
- Lodash - Properties
- Lodash - Methods
- Lodash Useful Resources
- Lodash - Quick Guide
- Lodash - Useful Resources
- Lodash - Discussion
Lodash - propertyOf method
Syntax
_.propertyOf(object)
The opposite of _.property; this method creates a function that returns the value at a given path of object.
Arguments
object (Object) − The object to query.
Output
(Function) − Returns the new accessor function.
Example
var _ = require('lodash'); var array = [0, 1, 2]; var object = { 'a': array, 'b': array, 'c': array }; console.log(_.map(['a[2]', 'c[0]'], _.propertyOf(object))); console.log(_.map([['a', '2'], ['c', '0']], _.propertyOf(object)));
Save the above program in tester.js. Run the following command to execute this program.
Command
\>node tester.js
Output
[ 2, 0 ] [ 2, 0 ]
lodash_util.htm
Advertisements
To Continue Learning Please Login
Login with Google