1 | import LodashWrapper from './_LodashWrapper.js';
|
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 | export default wrapperCommit;
|