1 |
3a515b92
|
cagy
|
var chain = require('./chain');
|
2 |
|
|
|
3 |
|
|
/**
|
4 |
|
|
* Creates a `lodash` wrapper instance with explicit method chain sequences enabled.
|
5 |
|
|
*
|
6 |
|
|
* @name chain
|
7 |
|
|
* @memberOf _
|
8 |
|
|
* @since 0.1.0
|
9 |
|
|
* @category Seq
|
10 |
|
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
11 |
|
|
* @example
|
12 |
|
|
*
|
13 |
|
|
* var users = [
|
14 |
|
|
* { 'user': 'barney', 'age': 36 },
|
15 |
|
|
* { 'user': 'fred', 'age': 40 }
|
16 |
|
|
* ];
|
17 |
|
|
*
|
18 |
|
|
* // A sequence without explicit chaining.
|
19 |
|
|
* _(users).head();
|
20 |
|
|
* // => { 'user': 'barney', 'age': 36 }
|
21 |
|
|
*
|
22 |
|
|
* // A sequence with explicit chaining.
|
23 |
|
|
* _(users)
|
24 |
|
|
* .chain()
|
25 |
|
|
* .head()
|
26 |
|
|
* .pick('user')
|
27 |
|
|
* .value();
|
28 |
|
|
* // => { 'user': 'barney' }
|
29 |
|
|
*/
|
30 |
|
|
function wrapperChain() {
|
31 |
|
|
return chain(this);
|
32 |
|
|
}
|
33 |
|
|
|
34 |
|
|
module.exports = wrapperChain;
|