Last active
October 10, 2017 03:18
-
-
Save mattpodwysocki/8b705e6f9dd1c7686ad7cd8c6b5de117 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { OperatorAsyncFunction } from '../../interfaces'; | |
import { AsyncIterableX } from '../../asynciterable'; | |
import { BufferAsyncIterable } from '../buffer'; | |
export function buffer<TSource>( | |
count: number, | |
skip?: number): OperatorAsyncFunction<TSource, TSource[]> { | |
if (skip == null) { skip = count; } | |
return function bufferCountOperatorFunction(source: AsyncIterable<TSource>): AsyncIterableX<TSource[]> { | |
return new BufferAsyncIterable<TSource>(source, count, skip!); | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { IterableX } from './iterable'; | |
import { AsyncIterableX } from './asynciterable'; | |
export type UnaryFunction<T, R> = (source: T) => R; | |
export type OperatorFunction<T, R> = UnaryFunction<Iterable<T>, IterableX<R>>; | |
export type OperatorAsyncFunction<T, R> = UnaryFunction<AsyncIterable<T>, AsyncIterableX<R>>; | |
export type FactoryOrValue<T> = T | (() => T); | |
export type MonoTypeOperatorFunction<T> = OperatorFunction<T, T>; | |
export type MonoTypeOperatorAsyncFunction<T> = OperatorAsyncFunction<T, T>; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment