1 var baseGet = require('./_baseGet');
4 * The opposite of `_.property`; this method creates a function that returns
5 * the value at a given path of `object`.
11 * @param {Object} object The object to query.
12 * @returns {Function} Returns the new accessor function.
15 * var array = [0, 1, 2],
16 * object = { 'a': array, 'b': array, 'c': array };
18 * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
21 * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
24 function propertyOf(object) {
25 return function(path) {
26 return object == null ? undefined : baseGet(object, path);
30 module.exports = propertyOf;