@nevware21/tripwire - v0.1.8
    Preparing search index...

    Function subsequenceFunc

    Export assertion functions

    • Checks if an array contains members in a specific order (non-consecutive) using strict equality.

      The function verifies that all expected members appear in the array in the specified order, but they don't need to be consecutive - other elements can appear between them. This is subsequence matching. Uses strict equality (===) for comparison.

      Type Parameters

      • R

      Parameters

      Returns R

      The current assertion scope for chaining

      assert([1, 2, 3, 4, 5]).includes.subsequence([2, 4, 5]);     // Passes - in order with gaps
      assert([1, 2, 3, 4, 5]).includes.subsequence([1, 3, 5]); // Passes - in order with gaps
      assert([1, 2, 3, 4, 5]).includes.subsequence([5, 3, 1]); // Fails - wrong order
      assert([1, 2, 3, 4, 5]).includes.subsequence([2, 2]); // Fails - not enough 2s
      assert(new Set([1, 2, 3])).includes.subsequence([1, 3]); // Passes - different types