Removed modules/contrib/media module to allow update to the core media module
[yaffs-website] / node_modules / uncss / node_modules / lodash / method.js
1 var baseInvoke = require('./internal/baseInvoke'),
2     rest = require('./rest');
3
4 /**
5  * Creates a function that invokes the method at `path` of a given object.
6  * Any additional arguments are provided to the invoked method.
7  *
8  * @static
9  * @memberOf _
10  * @category Util
11  * @param {Array|string} path The path of the method to invoke.
12  * @param {...*} [args] The arguments to invoke the method with.
13  * @returns {Function} Returns the new function.
14  * @example
15  *
16  * var objects = [
17  *   { 'a': { 'b': { 'c': _.constant(2) } } },
18  *   { 'a': { 'b': { 'c': _.constant(1) } } }
19  * ];
20  *
21  * _.map(objects, _.method('a.b.c'));
22  * // => [2, 1]
23  *
24  * _.invokeMap(_.sortBy(objects, _.method(['a', 'b', 'c'])), 'a.b.c');
25  * // => [1, 2]
26  */
27 var method = rest(function(path, args) {
28   return function(object) {
29     return baseInvoke(object, path, args);
30   };
31 });
32
33 module.exports = method;