Sha256: ec8a0e23fb86642c5b718db7b900ca52751bcabd8006b57ebee56cd3570ec4e0

Contents?: true

Size: 799 Bytes

Versions: 153

Compression:

Stored size: 799 Bytes

Contents

var baseProperty = require('../internal/baseProperty'),
    basePropertyDeep = require('../internal/basePropertyDeep'),
    isKey = require('../internal/isKey');

/**
 * Creates a function that returns the property value at `path` on a
 * given object.
 *
 * @static
 * @memberOf _
 * @category Utility
 * @param {Array|string} path The path of the property to get.
 * @returns {Function} Returns the new function.
 * @example
 *
 * var objects = [
 *   { 'a': { 'b': { 'c': 2 } } },
 *   { 'a': { 'b': { 'c': 1 } } }
 * ];
 *
 * _.map(objects, _.property('a.b.c'));
 * // => [2, 1]
 *
 * _.pluck(_.sortBy(objects, _.property(['a', 'b', 'c'])), 'a.b.c');
 * // => [1, 2]
 */
function property(path) {
  return isKey(path) ? baseProperty(path) : basePropertyDeep(path);
}

module.exports = property;

Version data entries

153 entries across 80 versions & 8 rubygems

Version Path
ilog-0.4.1 node_modules/contents/node_modules/lodash/utility/property.js
ilog-0.4.1 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/utility/property.js
ilog-0.4.1 node_modules/babel/node_modules/lodash/utility/property.js
ilog-0.4.0 node_modules/babel/node_modules/lodash/utility/property.js
ilog-0.4.0 node_modules/contents/node_modules/lodash/utility/property.js
ilog-0.4.0 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/utility/property.js
ilog-0.3.3 node_modules/babel/node_modules/lodash/utility/property.js
ilog-0.3.3 node_modules/contents/node_modules/lodash/utility/property.js
ilog-0.3.3 node_modules/babel-plugin-proto-to-assign/node_modules/lodash/utility/property.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/utility/property.js
trusty-festivity-extension-2.6.3 node_modules/bower/node_modules/inquirer/node_modules/lodash/utility/property.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/utility/property.js
trusty-festivity-extension-2.6.2 node_modules/bower/node_modules/inquirer/node_modules/lodash/utility/property.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/utility/property.js
trusty-festivity-extension-2.6.1 node_modules/bower/node_modules/inquirer/node_modules/lodash/utility/property.js
xcodebuild-helper-1.2.5 externals/ios-sim-master/node_modules/lodash/utility/property.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/utility/property.js
trusty-festivity-extension-2.6 node_modules/bower/node_modules/inquirer/node_modules/lodash/utility/property.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/configstore/node_modules/js-yaml/node_modules/argparse/node_modules/lodash/utility/property.js
trusty-festivity-extension-2.5.19 node_modules/bower/node_modules/inquirer/node_modules/lodash/utility/property.js