1 var baseProperty = require('./_baseProperty'),
2 basePropertyDeep = require('./_basePropertyDeep'),
3 isKey = require('./_isKey'),
4 toKey = require('./_toKey');
7 * Creates a function that returns the value at `path` of a given object.
13 * @param {Array|string} path The path of the property to get.
14 * @returns {Function} Returns the new accessor function.
18 * { 'a': { 'b': 2 } },
22 * _.map(objects, _.property('a.b'));
25 * _.map(_.sortBy(objects, _.property(['a', 'b'])), 'a.b');
28 function property(path) {
29 return isKey(path) ? baseProperty(toKey(path)) : basePropertyDeep(path);
32 module.exports = property;