Last change
on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
706 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | 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;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.