@reggi/help.filter-until

Filter an array until a match is made

Usage no npm install needed!

<script type="module">
  import reggiHelpFilterUntil from 'https://cdn.skypack.dev/@reggi/help.filter-until';
</script>

README

@reggi/help.filter-until

Why

Function that takes an array and filters using a function, until that function is not met.

Example

import filterUntil from '@reggi/help.filter-until'
const fn = (value) => value !== 'a'
const d = filterUntil(['a', 'a', 'a', 'a', 'b', 'a', 'a'], fn) // ['a', 'a', 'a', 'a']