2016-01-28 01:16:24 -08:00
|
|
|
define(['./_LodashWrapper'], function(LodashWrapper) {
|
2015-12-16 17:46:22 -08:00
|
|
|
|
|
|
|
|
/**
|
2016-03-26 00:00:01 -07:00
|
|
|
* Executes the chain sequence and returns the wrapped result.
|
2015-12-16 17:46:22 -08:00
|
|
|
*
|
|
|
|
|
* @name commit
|
|
|
|
|
* @memberOf _
|
2016-03-26 00:00:01 -07:00
|
|
|
* @since 3.2.0
|
2015-12-16 17:53:20 -08:00
|
|
|
* @category Seq
|
2015-12-16 17:46:22 -08:00
|
|
|
* @returns {Object} Returns the new `lodash` wrapper instance.
|
|
|
|
|
* @example
|
|
|
|
|
*
|
|
|
|
|
* var array = [1, 2];
|
2015-12-16 17:52:15 -08:00
|
|
|
* var wrapped = _(array).push(3);
|
2015-12-16 17:46:22 -08:00
|
|
|
*
|
|
|
|
|
* console.log(array);
|
|
|
|
|
* // => [1, 2]
|
|
|
|
|
*
|
2015-12-16 17:52:15 -08:00
|
|
|
* wrapped = wrapped.commit();
|
2015-12-16 17:46:22 -08:00
|
|
|
* console.log(array);
|
|
|
|
|
* // => [1, 2, 3]
|
|
|
|
|
*
|
2015-12-16 17:52:15 -08:00
|
|
|
* wrapped.last();
|
2015-12-16 17:46:22 -08:00
|
|
|
* // => 3
|
|
|
|
|
*
|
|
|
|
|
* console.log(array);
|
|
|
|
|
* // => [1, 2, 3]
|
|
|
|
|
*/
|
|
|
|
|
function wrapperCommit() {
|
|
|
|
|
return new LodashWrapper(this.value(), this.__chain__);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return wrapperCommit;
|
|
|
|
|
});
|