We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Examine if array contains an infix.
Similar: randomInfix, infixes, hasInfix, searchInfix. Similar: hasValue, hasPrefix, hasInfix, hasSuffix, hasSubsequence, hasPermutation, hasPath.
function hasInfix(x, y, fc, fm) // x: an array // y: search infix // fc: compare function (a, b) // fm: map function (v, i, x)
const xarray = require('extra-array'); var x = [1, 2, 3, 4]; xarray.hasInfix(x, [2, 3]); // → true xarray.hasInfix(x, [-2, -3]); // → false xarray.hasInfix(x, [-2, -3], (a, b) => Math.abs(a) - Math.abs(b)); // → true xarray.hasInfix(x, [-2, -3], null, v => Math.abs(v)); // → true