gensequence
Advanced tools
Comparing version 3.0.2 to 3.0.3
@@ -1,2 +0,2 @@ | ||
import { ChainFunction, SequenceBuilder } from './util/types'; | ||
import { ChainFunction, SequenceBuilder } from './types'; | ||
export declare const builder: Readonly<{ | ||
@@ -3,0 +3,0 @@ pipe: <T, U>(fn: ChainFunction<T, U>) => SequenceBuilder<T, U>; |
@@ -1,4 +0,4 @@ | ||
import { Sequence, GenIterable } from './util/types'; | ||
import { Sequence, GenIterable } from './types'; | ||
import { toIterableIterator } from './util/util'; | ||
export { Sequence, GenIterable } from './util/types'; | ||
export { Sequence, GenIterable } from './types'; | ||
export { toIterableIterator } from './util/util'; | ||
@@ -5,0 +5,0 @@ export interface SequenceCreator<T> { |
@@ -1,2 +0,2 @@ | ||
import { Sequence, GenIterable, Maybe, LazyIterable, ChainFunction } from './util/types'; | ||
import { Sequence, GenIterable, Maybe, LazyIterable, ChainFunction } from './types'; | ||
export declare class ImplSequence<T> implements Sequence<T> { | ||
@@ -20,3 +20,10 @@ private i; | ||
scan<U>(fnReduce: (prevValue: U, curValue: T, curIndex: number) => U, initValue: U): ImplSequence<U>; | ||
pipe<U>(fn: ChainFunction<T, U>): ImplSequence<U>; | ||
pipe(): Sequence<T>; | ||
pipe<T1>(fn0: ChainFunction<T, T1>): Sequence<T1>; | ||
pipe<T1, T2>(fn0: ChainFunction<T, T1>, fn1: ChainFunction<T1, T2>): Sequence<T2>; | ||
pipe<T1, T2, T3>(fn0: ChainFunction<T, T1>, fn1: ChainFunction<T1, T2>, fn2: ChainFunction<T2, T3>): Sequence<T3>; | ||
pipe<T1, T2, T3, T4>(fn0: ChainFunction<T, T1>, fn1: ChainFunction<T1, T2>, fn2: ChainFunction<T2, T3>, fn3: ChainFunction<T3, T4>): Sequence<T4>; | ||
pipe<T1, T2, T3, T4, T5>(fn0: ChainFunction<T, T1>, fn1: ChainFunction<T1, T2>, fn2: ChainFunction<T2, T3>, fn3: ChainFunction<T3, T4>, fn4: ChainFunction<T4, T5>): Sequence<T5>; | ||
pipe<T1, T2, T3, T4, T5, T6>(fn0: ChainFunction<T, T1>, fn1: ChainFunction<T1, T2>, fn2: ChainFunction<T2, T3>, fn3: ChainFunction<T3, T4>, fn4: ChainFunction<T4, T5>, fn5: ChainFunction<T5, T6>): Sequence<T6>; | ||
pipe<T1, T2, T3, T4, T5, T6>(fn0: ChainFunction<T, T1>, fn1: ChainFunction<T1, T2>, fn2: ChainFunction<T2, T3>, fn3: ChainFunction<T3, T4>, fn4: ChainFunction<T4, T5>, fn5: ChainFunction<T5, T6>, ...fnRest: ChainFunction<T6, T6>[]): Sequence<T6>; | ||
all(fnFilter: (t: T) => boolean): boolean; | ||
@@ -23,0 +30,0 @@ any(fnFilter: (t: T) => boolean): boolean; |
@@ -58,4 +58,7 @@ "use strict"; | ||
} | ||
pipe(fn) { | ||
return this.chain(fn); | ||
pipe(...fns) { | ||
if (!fns.length) | ||
return this; | ||
// Casting workaround due to the spread operator not working See: https://github.com/microsoft/TypeScript/issues/28010 | ||
return this.chain(operators_1.pipe.apply(null, fns)); | ||
} | ||
@@ -62,0 +65,0 @@ // Reducers |
@@ -1,2 +0,2 @@ | ||
import { SequenceBuilder, ChainFunction, LazyIterable, Sequence } from './util/types'; | ||
import { SequenceBuilder, ChainFunction, LazyIterable, Sequence } from './types'; | ||
export declare class ImplSequenceBuilder<S, T = S> implements SequenceBuilder<S, T> { | ||
@@ -3,0 +3,0 @@ private operators; |
export * from './GenSequence'; | ||
export { Sequence, LazyIterable, IterableLike, SequenceBuilder } from './util/types'; | ||
export { Sequence, LazyIterable, IterableLike, SequenceBuilder } from './types'; | ||
export * from './builder'; | ||
import * as _operators from './operators'; | ||
export declare const operators: typeof _operators; |
@@ -1,2 +0,2 @@ | ||
import { Maybe, IterableLike, ChainFunction, ReduceFunction } from '../util/types'; | ||
import { Maybe, IterableLike, ChainFunction, ReduceFunction } from '../types'; | ||
/** | ||
@@ -36,9 +36,9 @@ * Operators used by Sequence | ||
export declare type PipeFunction<T, U = T> = ChainFunction<T, U>; | ||
export declare function pipe<T>(...fns: PipeFunction<T, T>[]): PipeFunction<T, T>; | ||
export declare function pipe<T>(): PipeFunction<T>; | ||
export declare function pipe<T, T1>(fn0: PipeFunction<T, T1>): PipeFunction<T, T1>; | ||
export declare function pipe<T, T1, T2>(fn0: PipeFunction<T, T1>, fn1: PipeFunction<T1, T2>): PipeFunction<T, T2>; | ||
export declare function pipe<T, T1, T2, T3>(fn0: PipeFunction<T, T1>, fn1: PipeFunction<T1, T2>, fn2: PipeFunction<T2, T3>, fn3: PipeFunction<T2, T3>): PipeFunction<T, T3>; | ||
export declare function pipe<T, T1, T2, T3>(fn0: PipeFunction<T, T1>, fn1: PipeFunction<T1, T2>, fn2: PipeFunction<T2, T3>): PipeFunction<T, T3>; | ||
export declare function pipe<T, T1, T2, T3, T4>(fn0: PipeFunction<T, T1>, fn1: PipeFunction<T1, T2>, fn2: PipeFunction<T2, T3>, fn3: PipeFunction<T3, T4>): PipeFunction<T, T4>; | ||
export declare function pipe<T, T1, T2, T3, T4, T5>(fn0: PipeFunction<T, T1>, fn1: PipeFunction<T1, T2>, fn2: PipeFunction<T2, T3>, fn3: PipeFunction<T3, T4>, fn4: PipeFunction<T4, T5>): PipeFunction<T, T5>; | ||
export declare function pipe<T, T1, T2, T3, T4, T5, T6>(fn0: PipeFunction<T, T1>, fn1: PipeFunction<T1, T2>, fn2: PipeFunction<T2, T3>, fn3: PipeFunction<T3, T4>, fn4: PipeFunction<T4, T5>, fn5: PipeFunction<T5, T6>): PipeFunction<T, T6>; | ||
export declare function pipe<T, T1, T2, T3, T4, T5, T6>(fn0: PipeFunction<T, T1>, fn1: PipeFunction<T1, T2>, fn2: PipeFunction<T2, T3>, fn3: PipeFunction<T3, T4>, fn4: PipeFunction<T4, T5>, fn5: PipeFunction<T5, T6>, ...fnRest: PipeFunction<T6, T6>[]): PipeFunction<T, T6>; |
@@ -87,3 +87,3 @@ "use strict"; | ||
for (const fn of fns) { | ||
i = fn(i); | ||
i = fn ? fn(i) : i; | ||
} | ||
@@ -90,0 +90,0 @@ return i; |
@@ -1,2 +0,2 @@ | ||
import { Maybe, IterableLike } from '../util/types'; | ||
import { Maybe, IterableLike } from '../types'; | ||
/** | ||
@@ -3,0 +3,0 @@ * Operators used by Sequence |
{ | ||
"name": "gensequence", | ||
"version": "3.0.2", | ||
"version": "3.0.3", | ||
"description": "Small library to simplify working with Generators and Iterators in Javascript / Typescript", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41635
825