Nondeterministic Postrequisite Metaprotocol

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

    2.9.64 • Public • Published

    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.

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

    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

    Install

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

    DownloadsWeekly Downloads

    5

    Version

    2.9.64

    License

    MIT

    Unpacked Size

    14.1 kB

    Total Files

    29

    Last publish

    Collaborators

    • wolfram77