1 var baseProperty = require('./_baseProperty'),
2 basePropertyDeep = require('./_basePropertyDeep'),
3 isKey = require('./_isKey');
6 * Creates a function that returns the value at `path` of a given object.
11 * @param {Array|string} path The path of the property to get.
12 * @returns {Function} Returns the new function.
16 * { 'a': { 'b': { 'c': 2 } } },
17 * { 'a': { 'b': { 'c': 1 } } }
20 * _.map(objects, _.property('a.b.c'));
23 * _.map(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
26 function property(path) {
27 return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
30 module.exports = property;