@extra-array/is-prefix-on
TypeScript icon, indicating that this package has built-in type declarations

2.7.8 • Public • Published

Checks if array starts with a prefix. 🏃 📼 📦 🌔

Alternatives: compare, map.
Similar: prefix, prefixes, isPrefix.
This is part of package extra-array.

array.isPrefixOn(x, y, [fn], [ths]);
// x:   an array
// y:   prefix?
// fn:  map function (v, i, x)
// ths: this argument
const array = require('extra-array');

var x = [1, 2, 3, 4];
array.isPrefixOn(x, [1, 2]);
// true

array.isPrefixOn(x, [-1, -2]);
// false

array.isPrefixOn(x, [-1, -2], v => Math.abs(v));
// true

references

/@extra-array/is-prefix-on/

    Package Sidebar

    Install

    npm i @extra-array/is-prefix-on

    Weekly Downloads

    121

    Version

    2.7.8

    License

    MIT

    Unpacked Size

    7.56 kB

    Total Files

    19

    Last publish

    Collaborators

    • wolfram77