@daiso-tech/core
Version:
The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.
42 lines (41 loc) • 1.55 kB
TypeScript
/**
* @module Collection
*/
import type { IFlexibleSerde } from "../../serde/contracts/_module-exports.js";
import { type OneOrMore } from "../../utilities/_module-exports.js";
/**
* The `range` function return a {@link Iterable | `Iterable`} of numbers, starting from `from`,increments by 1 and stops at `to`.
* @example
* ```ts
* import { ListCollection, range } from "@daiso-tech/core/collection";
*
* const collection = new ListCollection(range(1, 10))
* collection.toArray();
* // [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
* ```
*
* IMPORT_PATH: `"@daiso-tech/core/collection"`
* @group Utilities
*/
export declare function range(from: number, to: number): Iterable<number>;
/**
* The `isIterable` returns true if the value is {@link Iterable | `Iterable`}.
*
* IMPORT_PATH: `"@daiso-tech/core/collection"`
* @group Utilities
*/
export declare function isIterable<TItem>(value: any): value is Iterable<TItem>;
/**
* The `isAsyncIterable` returns true if the value is {@link AsyncIterable | `AsyncIterable`}.
*
* IMPORT_PATH: `"@daiso-tech/core/collection"`
* @group Utilities
*/
export declare function isAsyncIterable<TItem>(value: any): value is AsyncIterable<TItem>;
/**
* The `registerCollectionsToSerde` function registers the `ListCollection` and `IterableCollection` classes with `IFlexibleSerde`, ensuring they will properly be serialized and deserialized.
*
* IMPORT_PATH: `"@daiso-tech/core/collection"`
* @group Errors
*/
export declare function registerCollectionsToSerde(serde: OneOrMore<IFlexibleSerde>): void;