title: typescript array remove item if condition matches
body: <p>I have an interface with some fields like that:</p>
  
  <pre class="lang-js prettyprint-override"><code>interface Item {
      id: number;
      name: string;
  }
  </code></pre>
  
  <p>And I want to implement a method <code>removeItemsWithName(items: Item[], name: string)</code> which removes all items from the given array, which have the given name:</p>
  
  <pre class="lang-js prettyprint-override"><code>const myItems: Item[] = [
      { id: 1, name: 'foo' },
      { id: 2, name: 'foo' },
      { id: 3, name: 'bar' }
  ];
  
  removeItemsWithName(myItems, 'foo');
  console.log(myItems);
  </code></pre>
  
  <p>The result should be:</p>
  
  <pre><code>[{id: 3, name: 'bar'}]
  </code></pre>
  
  <p>Is there a method <code>array.removeIf()</code> (like <a href="https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html#removeIf-java.util.function.Predicate-" rel="noreferrer"><code>Collection.removeIf()</code></a> in Java 8) available in typescript/javascript, so that my method could look like something similar to this:</p>
  
  <pre class="lang-js prettyprint-override"><code>function removeItemsWithName(items: Item[], name: string): void {
      items.removeIf(i =&gt; i.name === name);
  }
  </code></pre>
  
  <p>I already found the question <a href="https://stackoverflow.com/q/15287865/9662601">Remove array element based on object property</a>, but I need to modify the original array in place instead of creating a new one (like <code>array.filter()</code> does). I also want to remove all items matching the condition, not just the first one.</p>