Skip to content

hasValue

Subhajit Sahu edited this page Jun 28, 2020 · 14 revisions

Checks if array has a value. 🏃 📼 📦 🌔 📒

Similar: value, values, hasValue, searchValue.
Similar: hasValue, hasPrefix, hasInfix, hasSuffix, hasSubsequence, hasPermutation.

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

var x = [1, 2, -3];
array.hasValue(x, 3);
// false

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

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

references

Clone this wiki locally