UNPKG

@walts81/linq-ts

Version:

Typescript/Javascript LINQ implementation library

18 lines (17 loc) 527 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.removeAll = void 0; Array.prototype.removeAll = removeAll; function removeAll(expression, mutateArray = false) { if (!expression) { if (!mutateArray) return []; this.splice(0, this.length); return this; } if (!mutateArray) return this.filter((x, i) => !expression(x, i)); this.filter(expression).forEach(x => this.remove(x, true)); return this; } exports.removeAll = removeAll;