Last change
on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
641 bytes
|
Rev | Line | |
---|
[6a3a178] | 1 | var LodashWrapper = require('./_LodashWrapper');
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * Executes the chain sequence and returns the wrapped result.
|
---|
| 5 | *
|
---|
| 6 | * @name commit
|
---|
| 7 | * @memberOf _
|
---|
| 8 | * @since 3.2.0
|
---|
| 9 | * @category Seq
|
---|
| 10 | * @returns {Object} Returns the new `lodash` wrapper instance.
|
---|
| 11 | * @example
|
---|
| 12 | *
|
---|
| 13 | * var array = [1, 2];
|
---|
| 14 | * var wrapped = _(array).push(3);
|
---|
| 15 | *
|
---|
| 16 | * console.log(array);
|
---|
| 17 | * // => [1, 2]
|
---|
| 18 | *
|
---|
| 19 | * wrapped = wrapped.commit();
|
---|
| 20 | * console.log(array);
|
---|
| 21 | * // => [1, 2, 3]
|
---|
| 22 | *
|
---|
| 23 | * wrapped.last();
|
---|
| 24 | * // => 3
|
---|
| 25 | *
|
---|
| 26 | * console.log(array);
|
---|
| 27 | * // => [1, 2, 3]
|
---|
| 28 | */
|
---|
| 29 | function wrapperCommit() {
|
---|
| 30 | return new LodashWrapper(this.value(), this.__chain__);
|
---|
| 31 | }
|
---|
| 32 |
|
---|
| 33 | module.exports = wrapperCommit;
|
---|
Note:
See
TracBrowser
for help on using the repository browser.