1 var baseGet = require('../internal/baseGet'),
2 toPath = require('../internal/toPath');
5 * The opposite of `_.property`; this method creates a function that returns
6 * the property value at a given path on `object`.
11 * @param {Object} object The object to query.
12 * @returns {Function} Returns the new 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 baseGet(object, toPath(path), (path + ''));
30 module.exports = propertyOf;