@nevware21/ts-utils
    Preparing search index...

    Function arrDropWhile

    • The arrDropWhile() method returns a new array with elements from the beginning removed as long as the predicate function returns true. Once the predicate returns false, all remaining elements (including that one) are included in the result.

      Type Parameters

      • T

        Identifies the base type of array elements

      • E = T

        Identifies the narrowed type when using type guards

      Parameters

      • theArray: ArrayLike<T>

        The array or array-like object to drop from

      • callbackFn: ArrPredicateCallbackFn<T, E> | ArrPredicateCallbackFn2<T>

        Function to test each element. Return true to drop, false to stop dropping

      • OptionalthisArg: any

        Optional value to use as this when executing callbackFn

      Returns T[]

      A new array with leading elements removed while predicate was true

      0.14.0

      arrDropWhile([1, 2, 3, 4, 1], x => x < 3);      // [3, 4, 1]
      arrDropWhile([2, 4, 6, 1, 8], x => x % 2 === 0); // [1, 8]
      arrDropWhile([1, 2, 3], x => x > 5); // [1, 2, 3]
      arrDropWhile([1, 2, 3], x => x < 5); // []

      // Array-like objects
      arrDropWhile({ length: 4, 0: 1, 1: 2, 2: 3, 3: 4 }, x => x < 3); // [3, 4]