@extra-iterable/is-infix

Checks if iterable contains an infix.

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
@extra-iterable/is-infix
512.4.513 years ago3 years agoMinified + gzip package size for @extra-iterable/is-infix in KB

Readme

Checks if iterable contains an infix. :running: :vhs: :package: :moon: :ledger:
Similar: isInfix, searchInfix.
Similar: isValue, isPrefix, isInfix, isSuffix, isSubsequence.
This is part of package extra-iterable.

iterable.isInfix(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.isInfix(x, [2, 3]);
// true

iterable.isInfix(x, [-2, -3]);
// false

iterable.isInfix(x, [-2, -3], (a, b) => Math.abs(a) - Math.abs(b));
// true

iterable.isInfix(x, [-2, -3], null, v => Math.abs(v));
// true

references