source: frontend/node_modules/underscore/amd/underscore-array-methods.js

Last change on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago

Fix frontend appearance

  • Property mode set to 100644
File size: 980 bytes
Line 
1define(['./underscore', './each', './_setup', './_chainResult'], function (underscore, each, _setup, _chainResult) {
2
3 // Add all mutator `Array` functions to the wrapper.
4 each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {
5 var method = _setup.ArrayProto[name];
6 underscore.prototype[name] = function() {
7 var obj = this._wrapped;
8 if (obj != null) {
9 method.apply(obj, arguments);
10 if ((name === 'shift' || name === 'splice') && obj.length === 0) {
11 delete obj[0];
12 }
13 }
14 return _chainResult(this, obj);
15 };
16 });
17
18 // Add all accessor `Array` functions to the wrapper.
19 each(['concat', 'join', 'slice'], function(name) {
20 var method = _setup.ArrayProto[name];
21 underscore.prototype[name] = function() {
22 var obj = this._wrapped;
23 if (obj != null) obj = method.apply(obj, arguments);
24 return _chainResult(this, obj);
25 };
26 });
27
28 return underscore;
29
30});
Note: See TracBrowser for help on using the repository browser.