Add node modules and new code for release (#168)

Co-authored-by: OliverMKing <OliverMKing@users.noreply.github.com>
This commit is contained in:
github-actions[bot]
2022-02-02 10:11:19 -05:00
committed by GitHub
parent ca8d2604ac
commit a0f00e5017
8092 changed files with 1732166 additions and 149 deletions
+31
View File
@@ -0,0 +1,31 @@
var underscore = require('./underscore.js');
var each = require('./each.js');
var _setup = require('./_setup.js');
var _chainResult = require('./_chainResult.js');
// Add all mutator `Array` functions to the wrapper.
each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
var method = _setup.ArrayProto[name];
underscore.prototype[name] = function() {
var obj = this._wrapped;
if (obj != null) {
method.apply(obj, arguments);
if ((name === 'shift' || name === 'splice') && obj.length === 0) {
delete obj[0];
}
}
return _chainResult(this, obj);
};
});
// Add all accessor `Array` functions to the wrapper.
each(['concat', 'join', 'slice'], function(name) {
var method = _setup.ArrayProto[name];
underscore.prototype[name] = function() {
var obj = this._wrapped;
if (obj != null) obj = method.apply(obj, arguments);
return _chainResult(this, obj);
};
});
module.exports = underscore;