Checks if array ends with a suffix.
npm install @extra-array/has-suffixChecks if array ends with a suffix.
:package:
:smiley_cat:
:running:
:vhs:
:moon:
:scroll:
:newspaper:
:blue_book:
> Similar: [suffix], [suffixes], [hasSuffix].
> Similar: [hasValue], [hasPrefix], [hasInfix], [hasSuffix], [hasSubsequence], [hasPermutation], [hasPath].
> This is part of package [extra-array].
[extra-array]: https://www.npmjs.com/package/extra-array
``javascript`
array.hasSuffix(x, y, [fc], [fm]);
// x: an array
// y: suffix?
// fc: compare function (a, b)
// fm: map function (v, i, x)
`javascript
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
``
- Data.List.isSuffixOf: Haskell
- List-Extra.isSuffixOf: elm
- String.prototype.endsWith: MDN web docs
- ends-with: @jonschlinkert
[suffix]: https://github.com/nodef/extra-array/wiki/suffix
[suffixes]: https://github.com/nodef/extra-array/wiki/suffixes
[hasSuffix]: https://github.com/nodef/extra-array/wiki/hasSuffix
[hasValue]: https://github.com/nodef/extra-array/wiki/hasValue
[hasPrefix]: https://github.com/nodef/extra-array/wiki/hasPrefix
[hasInfix]: https://github.com/nodef/extra-array/wiki/hasInfix
[hasSubsequence]: https://github.com/nodef/extra-array/wiki/hasSubsequence
[hasPermutation]: https://github.com/nodef/extra-array/wiki/hasPermutation
[hasPath]: https://github.com/nodef/extra-array/wiki/hasPath