-
Notifications
You must be signed in to change notification settings - Fork 5
hasSuffix
Subhajit Sahu edited this page Jun 28, 2020
·
14 revisions
Checks if array ends with a suffix. [:running:] [:vhs:] [:package:] [:moon:] [:ledger:]
Similar: [suffix], [suffixes], [hasSuffix].
Similar: [hasValue], [hasPrefix], [hasInfix], [hasSuffix], [hasSubsequence], [hasPermutation].
array.isSuffix(x, y, [fc], [fm]);
// x: an array
// y: suffix?
// fc: compare function (a, b)
// fm: map function (v, i, x)
const array = require('extra-array');
var x = [1, 2, 3, 4];
array.hasSuffix(x, [3, 4]);
// true
array.hasSuffix(x, [-3, -4]);
// false
array.hasSuffix(x, [-3, -4], (a, b) => Math.abs(a) - Math.abs(b));
// true
array.hasSuffix(x, [-3, -4], null, v => Math.abs(v));
// true