import { type Doddle, type DoddleAsync } from "../doddle/index.js"; import { type MaybePromise } from "../utils.js"; import { ASeq } from "./aseq.class.js"; /** * Creates a {@link ASeq} from the sequential input. See examples for usage. * * @category Create * @example * // An array * aseq([1, 2, 3]) * * // A generator function * aseq(function* () { * yield 1 * yield 2 * }) * * // An async generator function * aseq(async function* () { * yield 1 * yield 2 * }) * * // An array-like object, such as a NodeList: * seq(document.getElementsByTagName("div")) * * // A readable stream * const response = await fetch("https://example.com/data") * aseq(response.body!) * * // An async function returning a sequence * aseq(async () => [1, 2, 3]) * * // A Doddle yielding a sequence * aseq(doddle(() => [1, 2, 3])) * * // An async Doddle yielding a sequence * aseq(doddle(async () => [1, 2, 3])) * * // An iterable * aseq(seq([1, 2, 3])) * * // An async iterable * aseq(aseq([1, 2, 3])) * * // An async function returning an async iterable * aseq(async () => aseq([1, 2, 3])) * * // ⛔ Strings are not allowed here. * seq("hello") * * @param input The input to create the {@link ASeq} from. */ export declare function aseq(input: readonly E[]): ASeq; export declare function aseq(input: ASeq.SimpleInput>>): ASeq; export declare function aseq(input: ASeq.SimpleInput>): ASeq; export declare function aseq(input: ASeq.SimpleInput>): ASeq; export declare function aseq(input: ASeq.SimpleInput>): ASeq; export declare function aseq(input: ASeq.SimpleInput>): ASeq; export declare function aseq(input: ASeq.Input): ASeq; /** * Tools for creating {@link ASeq} instances. * * @category Create * @class */ export declare namespace aseq { /** * Creates a {@link Seq} from the own, enumerable, string key-value pairs of an object. Values * are produced lazily. * * @template Object Type of the source object. * @param source Source object to create the {@link Seq} from. * @returns A {@link Seq} of key-value pairs from the source object. */ function fromObject(source: Object): ASeq<[keyof Object & string, Object[keyof Object]]>; /** * Creates an {@link ASeq} of items by iterating a projection function. * * @param count Number of items to iterate. * @param projection Function that receives the index and returns the item for that index, * possibly asynchronously. * @returns An {@link ASeq} of the generated items. */ function iterate(count: number, projection: ASeq.IndexIteratee): ASeq; /** * Creates an {@link ASeq} of numbers in the specified range. * * @param start Starting number of the range. * @param end Ending number of the range (exclusive). * @param size Step size for the range. Defaults to 1. * @returns An {@link ASeq} of numbers in the specified range. */ function range(start: number, end: number, size?: number): ASeq; /** * Checks if the provided input is an {@link ASeq}. * * @param input Input to check. * @returns `true` if the input is an {@link ASeq}, otherwise `false`. */ function is(input: any): input is ASeq; /** * Creates an {@link ASeq} that throws an error when iterated. * * @param thrower Function that returns the error to throw. * @returns An {@link ASeq} that throws the specified error when iterated. */ function throws(thrower: () => Error): ASeq; } //# sourceMappingURL=aseq.ctor.d.ts.map