Date

“Util” Methods

_.propertyOf(object)

source npm package

The opposite of _.property; this method creates a function that returns the value at a given path of object.

引入版本

3.0.0

参数
object (Object) : The object to query.

返回值
(Function) : Returns the new accessor function.

示例
var array = [0, 1, 2],
    object = { 'a': array, 'b': array, 'c': array };
 
_.map(['a[2]', 'c[0]'], _.propertyOf(object));
// => [2, 0]
 
_.map([['a', '2'], ['c', '0']], _.propertyOf(object));
// => [2, 0]