UNPKG

@codibre/fluent-iterable

Version:

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

42 lines (41 loc) 1.33 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.extend = void 0; const fluent_class_1 = require("./fluent-class"); /** * Used to add custom methods for the next fluent async iterables created * Is recommendable to also declare the method in the interface so it can be visible to typescript, like this: * ```ts * declare module '@codibre/fluent-iterable'{ * interface FluentIterable { * myCustomMethod<R>(myParams: someType): FluentIterable<R> * } * } * ``` */ exports.extend = { /** * 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_class_1.addFluentMethod)(name, operation); }, /** * Add a method that returns another FluentAsyncIterable * @param name The name of the method * @param operation The operation to be made */ useAsync(name, operation) { (0, fluent_class_1.addFluentAsyncMethod)(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_class_1.addFluentResolvingMethod)(name, operation); }, };