Checks if iterable starts with a prefix. :running: :vhs: :package: :moon: :ledger:
Similar: isValue, isPrefix, isInfix, isSuffix, isSubsequence.
This is part of package extra-iterable.
iterable.isPrefix(x, y, [fc], [fm]);
// x: an iterable
// y: prefix?
// fc: compare function (a, b)
// fm: map function (v, i, x)
const iterable = require('extra-iterable');
var x = [1, 2, 3, 4];
iterable.isPrefix(x, [1, 2]);
// true
iterable.isPrefix(x, [-1, -2]);
// false
iterable.isPrefix(x, [-1, -2], (a, b) => Math.abs(a) - Math.abs(b));
// true
iterable.isPrefix(x, [-1, -2], null, v => Math.abs(v));
// true