Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / chain / chain.js
1 var lodash = require('./lodash');
2
3 /**
4  * Creates a `lodash` object that wraps `value` with explicit method
5  * chaining enabled.
6  *
7  * @static
8  * @memberOf _
9  * @category Chain
10  * @param {*} value The value to wrap.
11  * @returns {Object} Returns the new `lodash` wrapper instance.
12  * @example
13  *
14  * var users = [
15  *   { 'user': 'barney',  'age': 36 },
16  *   { 'user': 'fred',    'age': 40 },
17  *   { 'user': 'pebbles', 'age': 1 }
18  * ];
19  *
20  * var youngest = _.chain(users)
21  *   .sortBy('age')
22  *   .map(function(chr) {
23  *     return chr.user + ' is ' + chr.age;
24  *   })
25  *   .first()
26  *   .value();
27  * // => 'pebbles is 1'
28  */
29 function chain(value) {
30   var result = lodash(value);
31   result.__chain__ = true;
32   return result;
33 }
34
35 module.exports = chain;