UNPKG

@codibre/fluent-iterable

Version:

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

32 lines (31 loc) 1.08 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.extendAsync = void 0; const fluent_async_class_1 = require("./fluent-async-class"); /** * Used to add custom methods for the next fluent async iterables created * Is recommendable to also declare the method in the interface namespace so it can be visible to typescript, like this: * ```ts * declare namespace FluentAsyncIterable { * myCustomMethod<R>(myParams: someType): FluentAsyncIterable<R> * } * ``` */ exports.extendAsync = { /** * Add a method that returns another FluentAsyncIterable * @param name The name of the method * @param operation The operation to be made */ use(name, operation) { (0, fluent_async_class_1.addAsyncFluentMethod)(name, operation); }, /** * Add a resolving method * @param name The name of the method * @param operation The resolving operation to be made */ useResolving(name, operation) { (0, fluent_async_class_1.addAsyncFluentResolvingMethod)(name, operation); }, };