UNPKG

monorepo-shared-assets

Version:

Shared assets used by various packages from nodemonorepo

31 lines (30 loc) 1.22 kB
export declare type Iter<X> = IterableIterator<X>; export declare function split<X>(iterable: Iterable<X>, choose: split.func.LineChooser<X>): Iter<split.func.Segment<X>>; export declare namespace split { function func<X>(iterable: Iterable<X>, choose: func.LineChooser<X>): Iter<func.Segment<X>>; namespace func { type Segment<X> = Segment.NotLast<X> | Segment.Last<X>; namespace Segment { interface Base<X> { readonly list: ReadonlyArray<X>; readonly line: X | void; readonly last: boolean; } interface NotLast<X> extends Base<X> { readonly line: X; readonly last: false; } interface Last<X> extends Base<X> { readonly line: void; readonly last: true; } } type LineChooser<X> = (x: X) => boolean; } function line<X>(iterable: Iterable<X>, separator: X, compare?: line.Comparator<X>): Iter<ReadonlyArray<X>>; namespace line { type Comparator<X> = (a: X, b: X) => boolean; const DEFAULT_COMPARATOR: (value1: any, value2: any) => boolean; } } export default split;