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[]) {
View merge.ts
'use strict';
import { AsyncIterableX } from '../asynciterable';
function neverPromiseFactory<T>() {
// tslint:disable-next-line:no-empty
return new Promise<T>(() => { });
}
class MergeAsyncIterable<T> extends AsyncIterableX<T> {
View cask-upgrade.sh
#!/usr/bin/env bash
(set -x; brew update;)
(set -x; brew upgrade;)
(set -x; brew cleanup;)
(set -x; brew cask cleanup;)
red=`tput setaf 1`
green=`tput setaf 2`
reset=`tput sgr0`
View Ix.ts
import { IterableX } from './iterable';
import { AsyncSink } from './asyncsink';
import { AsyncIterableX } from './asynciterable';
import { OrderedIterableX } from './iterable/orderby';
import { OrderedAsyncIterableX } from './asynciterable/orderby';
export {
IterableX as Iterable,
AsyncSink,
AsyncIterableX as AsyncIterable,
View asyncobservable.ts
'use strict';
interface AsyncSubscription {
unsubscribeAsync(): Promise<void>;
}
interface AsyncObserver<T> {
next(value: T): Promise<void>;
error(error: any): Promise<void>;
complete(): Promise<void>;