lists-indicesof

Get indices of all values in lists equal to specified value, like Array.indexOf().

Usage no npm install needed!

<script type="module">
  import listsIndicesof from 'https://cdn.skypack.dev/lists-indicesof';
</script>

README

lists-indicesof

NOTE: lists-indicesof was renamed to @extra-lists/indices-of. NPM

Get indices of all values in lists equal to specified value, like Array.indexOf().

const indicesOf = require('lists-indicesof');
// indicesOf(<lists>, <search value>)

a = ['sleeping dart', 'noisemaker', 'emp'];
indicesOf([a.keys(), a], 'emp');
// [2]
a = {u1: 'goggles', u2: 'torso', u3: 'torso'};
indicesOf([Object.keys(a), Object.values(a)], 'torso');
// ['u2', 'u3']