@extra-array/has-prefix.min
v2.10.19
Published
Checks if array starts with a prefix.
Downloads
22
Maintainers
Readme
Checks if array starts with a prefix. :package: :smiley_cat: :running: :vhs: :moon: :scroll: :newspaper: :blue_book:
Similar: prefix, prefixes, hasPrefix. Similar: hasValue, hasPrefix, hasInfix, hasSuffix, hasSubsequence, hasPermutation, hasPath.
This is part of package extra-array.
This is browserified, minified version of @extra-array/has-prefix. It is exported as global variable array_hasPrefix. CDN: unpkg, jsDelivr.
array.hasPrefix(x, y, [fc], [fm]);
// x: an array
// y: prefix?
// fc: compare function (a, b)
// fm: map function (v, i, x)
const array = require("extra-array");
var x = [1, 2, 3, 4];
array.hasPrefix(x, [1, 2]);
// true
array.hasPrefix(x, [-1, -2]);
// false
array.hasPrefix(x, [-1, -2], (a, b) => Math.abs(a) - Math.abs(b));
// true
array.hasPrefix(x, [-1, -2], null, v => Math.abs(v));
// true