UNPKG

everyutil

Version:

A comprehensive library of lightweight, reusable utility functions for JavaScript and TypeScript, designed to streamline common programming tasks such as string manipulation, array processing, date handling, and more.

21 lines (20 loc) 559 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.skipUntil = void 0; /** * Skips until predicate returns true, returns the rest. * @author @dailker * @template T * @param {T[]} array * @param {(item: T, idx: number, arr: T[]) => boolean} predicate * @returns {T[]} */ function skipUntil(array, predicate) { for (let i = 0; i < array.length; i++) { if (predicate(array[i], i, array)) { return array.slice(i); } } return []; } exports.skipUntil = skipUntil;