-
Notifications
You must be signed in to change notification settings - Fork 5
hasInfix
Subhajit Sahu edited this page Jun 28, 2020
·
14 revisions
Checks if array contains an infix. 🏃 📼 📦 🌔 📒
Similar: infix, infixes, hasInfix, searchInfix.
Similar: hasValue, hasPrefix, hasInfix, hasSuffix, hasSubsequence, hasPermutation, hasPath.
array.hasInfix(x, y, [fc], [fm]);
// x: an array
// y: infix?
// fc: compare function (a, b)
// fm: map function (v, i, x)
const array = require('extra-array');
var x = [1, 2, 3, 4];
array.hasInfix(x, [2, 3]);
// true
array.hasInfix(x, [-2, -3]);
// false
array.hasInfix(x, [-2, -3], (a, b) => Math.abs(a) - Math.abs(b));
// true
array.hasInfix(x, [-2, -3], null, v => Math.abs(v));
// true