Repository URL to install this package:
|
Version:
5.0.0-rc.11 ▾
|
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var _isKey = require('./_isKey.js');
var _toKey = require('./_toKey.js');
var _baseProperty = require('./_baseProperty.js');
var _basePropertyDeep = require('./_basePropertyDeep.js');
/**
* 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.default(path) ? _baseProperty.default(_toKey.default(path)) : _basePropertyDeep.default(path);
}
var property_1 = property;
exports.__moduleExports = property_1;
exports.default = property_1;
//# sourceMappingURL=property.js.map