JSPM

@extra-array/is-subsequence

2.9.64
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 408
  • Score
    100M100P100Q87328F
  • License MIT

Checks if array has a subsequence.

Package Exports

  • @extra-array/is-subsequence

Readme

Checks if array has a subsequence. 🏃 📼 📦 🌔 📒

Similar: subsequence, subsequences, isSubsequence, searchSubsequence.
Similar: isValue, isPrefix, isInfix, isSuffix, isSubsequence, isPermutation.
This is part of package extra-array.

array.isSubsequence(x, y, [fc], [fm]);
// x:  an array
// y:  subsequence?
// fc: compare function (a, b)
// fm: map function (v, i, x)
const array = require('extra-array');

var x = [1, 2, 3, 4];
array.isSubsequence(x, [2, 4]);
// true

array.isSubsequence(x, [-2, -4]);
// false

array.isSubsequence(x, [-2, -4], (a, b) => Math.abs(a) - Math.abs(b));
// true

array.isSubsequence(x, [-2, -4], null, v => Math.abs(v));
// true

references