@extra-array/search-subsequence.min
TypeScript icon, indicating that this package has built-in type declarations

2.10.19 • Public • Published

Finds first index of a subsequence. 📦 😺 🏃 📼 🌔 📜 📰 📘

Similar: subsequence, subsequences, hasSubsequence, searchSubsequence.
Similar: hasValue, hasPrefix, hasInfix, hasSuffix, hasSubsequence, hasPermutation.

This is part of package extra-array.

This is browserified, minified version of @extra-array/search-subsequence.
It is exported as global variable array_searchSubsequence.
CDN: unpkg, jsDelivr.


array.searchSubsequence(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.searchSubsequence(x, [2, 4]);
// 1

array.searchSubsequence(x, [-2, -4]);
// -1

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

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


References

Package Sidebar

Install

npm i @extra-array/search-subsequence.min

Weekly Downloads

43

Version

2.10.19

License

MIT

Unpacked Size

6.87 kB

Total Files

8

Last publish

Collaborators

  • wolfram77