UNPKG

@antv/layout

Version:
49 lines (43 loc) 1.32 kB
import { __require as require_baseProperty } from './_baseProperty.js'; import { __require as require_basePropertyDeep } from './_basePropertyDeep.js'; import { __require as require_isKey } from './_isKey.js'; import { __require as require_toKey } from './_toKey.js'; var property_1; var hasRequiredProperty; function requireProperty () { if (hasRequiredProperty) return property_1; hasRequiredProperty = 1; var baseProperty = require_baseProperty(), basePropertyDeep = require_basePropertyDeep(), isKey = require_isKey(), toKey = require_toKey(); /** * 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(path) ? baseProperty(toKey(path)) : basePropertyDeep(path); } property_1 = property; return property_1; } export { requireProperty as __require }; //# sourceMappingURL=property.js.map