property

最后更新于:2022-04-02 00:08:48

## property + [link](./property "Link to this entry.") + [source](https://github.com/lodash/lodash/blob/4.5.0正式版/lodash.src.js#L13640 "View in source.") + [npm](https://www.npmjs.com/package/lodash.property "See the npm package.") ``` _.property(path) ``` 创建一个返回给定对象的 `path` 的值的函数。 ### 参数 1. path (Array|string) 要得到值的属性路径 ### 返回值 (Function) 返回新的函数 ### 示例 ``` var objects = [ { 'a': { 'b': { 'c': 2 } } }, { 'a': { 'b': { 'c': 1 } } } ]; _.map(objects, _.property('a.b.c')); // => [2, 1] _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c'); // => [1, 2] ```
';