sparse-splice

remove elements scattered over an array

Usage no npm install needed!

<script type="module">
  import sparseSplice from 'https://cdn.skypack.dev/sparse-splice';
</script>

README

sparse-splice

NPM Version Build Status Coverage Status

Like Array.splice but instead of removing a consecutive range of elements this module allows for the elements to be scattered all over the array.

Installation

npm install --save sparse-splice

Usage

var cats = [ 'Dusty'
           , 'Casper'
           , 'Samantha'
           , 'Maggie'
           , 'Chester'
           , 'Sadie'
           , 'Coco'
           , 'Lola'
           ]

// Remove Sadie, Coco and Maggie
require('sparse-splice')(cats, [5, 6, 3])

// cats = ['Dusty', 'Casper', 'Samantha', 'Chester', 'Lola']