We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Examine if array ends with a suffix.
Similar: randomSuffix, suffixes, hasSuffix. Similar: hasValue, hasPrefix, hasInfix, hasSuffix, hasSubsequence, hasPermutation, hasPath.
function hasSuffix(x, y, fc, fm) // x: an array // y: search suffix // fc: compare function (a, b) // fm: map function (v, i, x)
const xarray = require('extra-array'); var x = [1, 2, 3, 4]; xarray.hasSuffix(x, [3, 4]); // → true xarray.hasSuffix(x, [-3, -4]); // → false xarray.hasSuffix(x, [-3, -4], (a, b) => Math.abs(a) - Math.abs(b)); // → true xarray.hasSuffix(x, [-3, -4], null, v => Math.abs(v)); // → true