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