UNPKG

fluent-iterable

Version:

Provides LINQ-like fluent api operations for iterables and async iterables (ES2018+).

30 lines (29 loc) 1.33 kB
import { Group, FluentGroup } from './types'; /** @internal */ declare const identity: <T>(t: T) => T; /** @internal */ declare const identityAsync: <T>(t: T) => Promise<T>; /** @internal */ declare const truth: () => boolean; /** @internal */ declare const truthAsync: () => Promise<boolean>; /** @internal */ declare const fluentGroup: <T, R>(grp: Group<T, R>) => FluentGroup<T, R>; /** * Generates a `count` long sequential integer interval starting from `fromInclusive`. * * * The interval starts at zero if `fromInclusive` is not specified. * * The interval ends in infinity if `count` is not specified. * * Examples: * * 1. `interval(5, 3)` generates an interval of `[5, 6, 7]` * 2. `interval(5)` generates an interval of `[5, 6, 7, ...]` * 3. `interval()` generates an interval of `[0, 1, 2, ...]` * 4. `fluent(interval(1)).take(10).forEach(console.log)` prints all numbers between 1 and 10 using [[fluent]]. * @param fromInclusive Specifies the start of the interval. Defaults to zero. * @param count Specifies the length of the interval. The interval provides numbers indefinitely if omitted. * @returns The iterable of numbers in the interval. */ declare function interval(fromInclusive?: number, count?: number): Iterable<number>; export { identity, identityAsync, truth, truthAsync, fluentGroup, interval };