@extra-lists/has-value

Checks if lists has a value. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Usage no npm install needed!

<script type="module">
  import extraListsHasValue from 'https://cdn.skypack.dev/@extra-lists/has-value';
</script>

README

Checks if lists has a value. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:

Alternatives: has, hasValue, hasEntry, hasSubset, hasPath.
Similar: value, values, hasValue.

This is part of package extra-lists.


lists.hasValue(x, v, [fc], [fm]);
// x:  lists
// v:  value?
// fc: compare function (a, b)
// fm: map function (v, k, x)
const lists = require('extra-lists');

var x = [['a', 'b', 'c'], [1, 2, -3]];
lists.hasValue(x, 3);
// false

lists.hasValue(x, 3, (a, b) => Math.abs(a) - Math.abs(b));
// true

lists.hasValue(x, 3, null, v => Math.abs(v));
// true


References