UNPKG

@augment-vir/common

Version:

A collection of augments, helpers types, functions, and classes for any JavaScript environment.

20 lines (19 loc) 847 B
/** * Finds all indexes of a `searchFor` string or RegExp in `searchIn`. Ths is similar to * [`''.indexOf`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf) * except that it finds _all_ indexes of. * * @category String * @category Package : @augment-vir/common * @package [`@augment-vir/common`](https://www.npmjs.com/package/@augment-vir/common) */ export declare function findSubstringIndexes<IncludeLength extends boolean | undefined>({ searchIn, searchFor, caseSensitive, includeLength, }: { searchIn: string; searchFor: string | RegExp; caseSensitive: boolean; /** Set to true to get an array of objects with the found indexes _and_ their lengths. */ includeLength?: IncludeLength; }): IncludeLength extends true ? { index: number; length: number; }[] : number[];