-
Notifications
You must be signed in to change notification settings - Fork 1
hasSuffix
Subhajit Sahu edited this page Feb 3, 2021
·
11 revisions
Check if iterable ends with a suffix.
Alternatives: hasValue, hasPrefix, hasInfix, hasSuffix, hasSubsequence, hasPath.
function hasSuffix(x, y, fc, fm)
// x: an iterable
// y: seach suffix
// fc: compare function (a, b)
// fm: map function (v, i, x)
const xiterable = require('extra-iterable');
var x = [1, 2, 3, 4];
xiterable.hasSuffix(x, [3, 4]);
// → true
xiterable.hasSuffix(x, [-3, -4]);
// → false
xiterable.hasSuffix(x, [-3, -4], (a, b) => Math.abs(a) - Math.abs(b));
// → true
xiterable.hasSuffix(x, [-3, -4], null, v => Math.abs(v));
// → true