1 var baseProperty = require('../internal/baseProperty'),
2 basePropertyDeep = require('../internal/basePropertyDeep'),
3 isKey = require('../internal/isKey');
6 * Creates a function that returns the property value at `path` on a
12 * @param {Array|string} path The path of the property to get.
13 * @returns {Function} Returns the new function.
17 * { 'a': { 'b': { 'c': 2 } } },
18 * { 'a': { 'b': { 'c': 1 } } }
21 * _.map(objects, _.property('a.b.c'));
24 * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
27 function property(path) {
28 return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
31 module.exports = property;