fdsfd
This commit is contained in:
parent
628618df89
commit
e031240dff
3749 changed files with 1120848 additions and 1 deletions
32
node_modules/lodash/property.js
generated
vendored
Normal file
32
node_modules/lodash/property.js
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
var baseProperty = require('./_baseProperty'),
|
||||
basePropertyDeep = require('./_basePropertyDeep'),
|
||||
isKey = require('./_isKey'),
|
||||
toKey = require('./_toKey');
|
||||
|
||||
/**
|
||||
* Creates a function that returns the value at `path` of a given object.
|
||||
*
|
||||
* @static
|
||||
* @memberOf _
|
||||
* @since 2.4.0
|
||||
* @category Util
|
||||
* @param {Array|string} path The path of the property to get.
|
||||
* @returns {Function} Returns the new accessor function.
|
||||
* @example
|
||||
*
|
||||
* var objects = [
|
||||
* { 'a': { 'b': 2 } },
|
||||
* { 'a': { 'b': 1 } }
|
||||
* ];
|
||||
*
|
||||
* _.map(objects, _.property('a.b'));
|
||||
* // => [2, 1]
|
||||
*
|
||||
* _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
|
||||
* // => [1, 2]
|
||||
*/
|
||||
function property(path) {
|
||||
return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
|
||||
}
|
||||
|
||||
module.exports = property;
|
Loading…
Add table
Add a link
Reference in a new issue