List of utility methods to do Array Delete by Index
delete()Array.prototype.delete = function() { var arr = this; var todel = arguments[0]; if(todel && todel instanceof Array) { var arraux = []; for(var i=0; i<todel.length;i++) { arr.some(function(el, j){ if(el == todel[i]){ arraux.push(j+''); ... | |
delete(index)'use strict'; Array.prototype.delete = function (index) { delete this[index]; this.splice(index, 1); return this; }; | |
deleteAll()Array.prototype.deleteAll = function(){ var arr = this; arr.splice(0,arr.length); | |
deleteAt(index)Array.prototype.deleteAt = function(index) { return this.splice(index, 1); }; | |
deleteItems(ids, filterEmpty = true)Array.prototype.deleteItems = function (ids, filterEmpty = true) { var result = this.slice(); if (typeof ids === 'object' && ids.constructor === [].constructor) { ids.sort(function (a, b) { return b > a; }).forEach(function (value) { if (filterEmpty) { result.splice(value, 1); } else { ... | |
delete_at(from, to)Array.prototype.delete_at = function(from, to) { var rest = this.slice((to || from) + 1 || this.length); this.length = from < 0 ? this.length + from : from; return this.push.apply(this, rest); Array.prototype.delete_if = function(matcher){ for(var i = 0; i < this.length; i++){ if(matcher(this[i])) { this.delete_at(i) ... |