Nodejs Utililty Methods Array Remove

List of utility methods to do Array Remove

Description

The list of methods to do Array Remove are organized into topic(s).

Method

removeElementByProperty(chave,obj)
Array.prototype.removeElementByProperty = function(chave,obj) {
    var i = this.length;
    while (i--) {
      if (angular.equals(this[i][chave], obj)) {
          this.splice(i,1);
};
removeEmpty()
Array.prototype.removeEmpty = function () {
  for (var i = 0; i < this.length; ++i) {
    if (this[i].replace(/^\s*$/, "") === "") {
      this.splice(i--, 1);
  return this;
};
removeEmpty()
Array.prototype.removeEmpty = function() {
  var cleanArray = this.filter(function(n) {
      return (n !== undefined && n !== null && n !== '');
  });
  return cleanArray;
};
removeMultiple(values)
Array.prototype.removeMultiple = function(values)
  for (var i = 0; i < values.length; i++)
    this.splice(this.indexOf(values[i]), 1);
    i--;
removeNegatives()
Array.prototype.removeNegatives = function() {
  var negCount = 0;
  for (var index = 0; index < this.length; index++) {
    if(this[index] >= 0){
      this[index - negCount] = this[index];
    } else {
      negCount++
  this.length = this.length-negCount;
array2 = [-1,2.4,-3.1,4,-5.0,-6];
array2.removeNegatives();
console.log(array2);
removeRange(start, end)
Array.prototype.removeRange = function(start, end){
  this.splice(start, end-start);
removeSame()
Array.prototype.removeSame = function() {
  let theNewArray = [];
  this.map((value, index, array) => {
    if (array.indexOf(value) === index) {
      theNewArray.push(value);
  });
  return theNewArray;
};
...
removeWhere(property, value)
Array.prototype.removeWhere = function (property, value) {
    "use strict";
    for(var i = 0; i < this.length; i++) {
        if(this[i][property] === value) {
            this.splice(i, 1);
            break;
};
...
remove_(integer_list, value_list)
Array.prototype.remove_ = function(integer_list, value_list) {
  return integer_list.filter( function(i) {
    return !value_list.some(function(v) {
      return v === i;
    });
  });
var l = []
var integer_list =  [1, 1, 2 ,3 ,1 ,2 ,3 ,4]
...
remove_(integer_list, values_list)
Array.prototype.remove_ = function(integer_list, values_list){
var arr = integer_list;
var newarr;
function list (integers_list, value) {
  for (var j = 0; j<integers_list.length; j++) {
      if (value!==integers_list[j]) {
        newarr.push(integers_list[j]);
    return newarr;
  for (var i = 0; i<values_list.length; i++) {
    newarr = [];
    arr = list(arr, values_list[i])
  return arr;