Checks if array has a permutation.
npm install @extra-array/has-permutationChecks if array has a permutation.
:package:
:smiley_cat:
:running:
:vhs:
:moon:
:scroll:
:newspaper:
:blue_book:
> Similar: [permutation], [permutations], [hasPermutation].
> 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.hasPermutation(x, y, [fc], [fm]);
// x: an array
// y: permutation?
// fc: map function (v, i, x)
// fm: compare function (a, b)
`javascript
const array = require("extra-array");
var x = [1, 2, 3, 4];
array.hasPermutation(x, [4, 3, 2, 1]);
// true
array.hasPermutation(x, [3, -1, -2, 4]);
// false
array.hasPermutation(x, [3, -1, -2, 4], (a, b) => Math.abs(a) - Math.abs(b));
// true
array.hasPermutation(x, [3, -1, -2, 4], null, v => Math.abs(v));
// true
``
- Data.List.permutations: Haskell
- List-Extra.isPermutationOf: elm
[permutation]: https://github.com/nodef/extra-array/wiki/permutation
[permutations]: https://github.com/nodef/extra-array/wiki/permutations
[hasPermutation]: https://github.com/nodef/extra-array/wiki/hasPermutation
[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
[hasSuffix]: https://github.com/nodef/extra-array/wiki/hasSuffix
[hasSubsequence]: https://github.com/nodef/extra-array/wiki/hasSubsequence
[hasPath]: https://github.com/nodef/extra-array/wiki/hasPath