mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
638 B
33 lines
638 B
10 years ago
|
var chain = require('./chain');
|
||
|
|
||
|
/**
|
||
|
* Enables explicit method chaining on the wrapper object.
|
||
|
*
|
||
|
* @name chain
|
||
|
* @memberOf _
|
||
|
* @category Chain
|
||
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
||
|
* @example
|
||
|
*
|
||
|
* var users = [
|
||
|
* { 'user': 'barney', 'age': 36 },
|
||
|
* { 'user': 'fred', 'age': 40 }
|
||
|
* ];
|
||
|
*
|
||
|
* // without explicit chaining
|
||
|
* _(users).first();
|
||
|
* // => { 'user': 'barney', 'age': 36 }
|
||
|
*
|
||
|
* // with explicit chaining
|
||
|
* _(users).chain()
|
||
|
* .first()
|
||
|
* .pick('user')
|
||
|
* .value();
|
||
|
* // => { 'user': 'barney' }
|
||
|
*/
|
||
|
function wrapperChain() {
|
||
|
return chain(this);
|
||
|
}
|
||
|
|
||
|
module.exports = wrapperChain;
|