View AceOfBase.ts
'use strict';
export abstract class AceOfBase {
private _eyesOpen: boolean = false;
openEyes(): void {
this._eyesOpen = true;
}
sawSign(): boolean {
View asyncify.ts
import { AsyncIterableX } from '../asynciterable';
import { AsyncSink } from '../asyncsink';
import { memoize } from './memoize';
export function asyncify<TSource>(
func: Function
): (...args: any[]) => AsyncIterableX<TSource> {
return function(...args: any[]) {
const sink = new AsyncSink<TSource>();
View bindcallback.ts
import { AsyncIterableX } from '../asynciterable';
import { AsyncSink } from '../asyncsink';
import { memoize } from './memoize';
export function bindCallback<TSource>(
func: Function,
selector: Function
): (...args: any[]) => AsyncIterableX<TSource> {
return function(...args: any[]) {
View concat.ts
import { AsyncIterableX } from '../asynciterable';
class ConcatAsyncIterable<TSource> extends AsyncIterableX<TSource> {
private _source: Iterable<AsyncIterable<TSource>>;
constructor(source: Iterable<AsyncIterable<TSource>>) {
super();
this._source = source;
}
View server.js
const http = require('http')
const port = 3000
const requestHandler = (request, response) => {
console.log(request.url)
response.end('Hello Node.js Server!')
}
const server = http.createServer(requestHandler)
View pipe.ts
import { OperatorAsyncFunction } from '../interfaces';
import { AsyncIterableX } from '../asynciterable';
/* tslint:disable:max-line-length */
export function pipe<T>(source: AsyncIterable<T>): AsyncIterableX<T>;
export function pipe<T, A>(source: AsyncIterable<T>, op1: OperatorAsyncFunction<T, A>): AsyncIterableX<A>;
export function pipe<T, A, B>(source: AsyncIterable<T>, op1: OperatorAsyncFunction<T, A>, op2: OperatorAsyncFunction<A, B>): AsyncIterableX<B>;
export function pipe<T, A, B, C>(source: AsyncIterable<T>, op1: OperatorAsyncFunction<T, A>, op2: OperatorAsyncFunction<A, B>, op3: OperatorAsyncFunction<B, C>): AsyncIterableX<C>;
export function pipe<T, A, B, C, D>(source: AsyncIterable<T>, op1: OperatorAsyncFunction<T, A>, op2: OperatorAsyncFunction<A, B>, op3: OperatorAsyncFunction<B, C>, op4: OperatorAsyncFunction<C, D>): AsyncIterableX<D>;
export function pipe<T, A, B, C, D, E>(source: AsyncIterable<T>, op1: OperatorAsyncFunction<T, A>, op2: OperatorAsyncFunction<A, B>, op3: OperatorAsyncFunction<
View buffer-pipe.ts
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!);
View merge.ts
import { AsyncIterableX } from '../asynciterable';
// tslint:disable-next-line:no-empty
const NEVER_PROMISE = new Promise(() => { });
class MergeAsyncIterable<T> extends AsyncIterableX<T> {
private _source: AsyncIterable<T>[];
constructor(source: AsyncIterable<T>[]) {
super();
View stream.js
'use strict';
import * as fs from 'fs';
import { AsyncSink, AsyncIterable } from 'ix';
AsyncIterable.from(fs
.createReadStream('some.file')
.pipe(new AsyncSink()))
.flatMap(file => /* yes */)
.forEach(/* HEAVEN */)
View append.ts
'use strict';
import { AsyncIterableX } from '../asynciterable';
import { MonoTypeAsyncIteratorOperatorFunction } from '../interfaces';
export class AppendAsyncIterable<TSource> extends AsyncIterableX<TSource> {
private _source: AsyncIterable<TSource>;
private _args: TSource[];
constructor(source: AsyncIterable<TSource>, args: TSource[]) {