Checks if array ends with a suffix.

Downloads in past


1622.7.83 years ago3 years agoMinified + gzip package size for @extra-array/is-suffix-on.min in KB


Checks if array ends with a suffix. :running: :vhs: :package: :moon:
Alternatives: compare, map.
Similar: suffix, suffixes, isSuffix.
This is part of package extra-array.

This is browserified, minified version of @extra-array/is-suffix-on.
It is exported as global variable arrayisSuffixOn.
CDN: unpkg
, jsDelivr.

array.isSuffixOn(x, y, [fn], [ths]);
// x:   an array
// y:   suffix?
// fn:  map function (v, i, x)
// ths: this argument

const array = require('extra-array');

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

array.isSuffixOn(x, [-3, -4]);
// false

array.isSuffixOn(x, [-3, -4], v => Math.abs(v));
// true