Added the Porter Stemmer module to improve searches. This doesn't deal with some...
[yaffs-website] / node_modules / uncss / node_modules / lodash / propertyOf.js
1 var baseGet = require('./internal/baseGet');
2
3 /**
4  * The opposite of `_.property`; this method creates a function that returns
5  * the value at a given path of `object`.
6  *
7  * @static
8  * @memberOf _
9  * @category Util
10  * @param {Object} object The object to query.
11  * @returns {Function} Returns the new function.
12  * @example
13  *
14  * var array = [0, 1, 2],
15  *     object = { 'a': array, 'b': array, 'c': array };
16  *
17  * _.map(['a[2]', 'c[0]'], _.propertyOf(object));
18  * // => [2, 0]
19  *
20  * _.map([['a', '2'], ['c', '0']], _.propertyOf(object));
21  * // => [2, 0]
22  */
23 function propertyOf(object) {
24   return function(path) {
25     return object == null ? undefined : baseGet(object, path);
26   };
27 }
28
29 module.exports = propertyOf;