Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
80742 views
1
var LodashWrapper = require('../internal/LodashWrapper');
2
3
/**
4
* Executes the chained sequence and returns the wrapped result.
5
*
6
* @name commit
7
* @memberOf _
8
* @category Chain
9
* @returns {Object} Returns the new `lodash` wrapper instance.
10
* @example
11
*
12
* var array = [1, 2];
13
* var wrapper = _(array).push(3);
14
*
15
* console.log(array);
16
* // => [1, 2]
17
*
18
* wrapper = wrapper.commit();
19
* console.log(array);
20
* // => [1, 2, 3]
21
*
22
* wrapper.last();
23
* // => 3
24
*
25
* console.log(array);
26
* // => [1, 2, 3]
27
*/
28
function wrapperCommit() {
29
return new LodashWrapper(this.value(), this.__chain__);
30
}
31
32
module.exports = wrapperCommit;
33
34