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 { 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, |
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
'use strict'; | |
interface AsyncSubscription { | |
unsubscribeAsync(): Promise<void>; | |
} | |
interface AsyncObserver<T> { | |
next(value: T): Promise<void>; | |
error(error: any): Promise<void>; | |
complete(): Promise<void>; |
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 { fs } from 'fs'; | |
import { AsyncSink } from 'ix/asyncsink'; | |
function fromReadableStream(path: string, options: any) { | |
const sink = new AsyncSink(); | |
const stream = fs.createReadStream(path, options); | |
stream.on('readable', () => { | |
let data = null; | |
while ((data = stream.read()) !== null) { | |
sink.write(data); |
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
/** | |
* @ignore | |
*/ | |
export function returnIterator<T>(it: Iterator<T>) { | |
if (typeof it.return === 'function') { | |
it.return(); | |
} | |
} | |
/** |
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'; | |
function returnIterator<T>(it: Iterator<T>) { | |
if (typeof it.return === 'function') { | |
it.return(); | |
} | |
} | |
class CatchIterable<TSource> extends IterableX<TSource> { | |
private _source: Iterable<Iterable<TSource>>; |
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
console.js:106 | |
`${util.format.apply(null, args)}\n`, | |
^ | |
RangeError: Maximum call stack size exceeded | |
at Console.log (console.js:106:24) | |
at log (/Users/matthewp/GitHub/rx/IxJS/node_modules/fancy-log/index.js:15:15) | |
at Object.module.exports [as log] (/Users/matthewp/GitHub/rx/IxJS/node_modules/gulp-util/lib/log.js:11:14) | |
at Gulp.<anonymous> (/Users/matthewp/GitHub/rx/IxJS/node_modules/gulp/bin/gulp.js:197:11) | |
at emitOne (events.js:115:13) |
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
'use strict'; | |
import { AsyncIterableX } from '../asynciterable'; | |
class TakeUntilAsyncIterable<TSource> extends AsyncIterableX<TSource> { | |
private _source: AsyncIterable<TSource>; | |
private _other: Promise<any>; | |
constructor(source: AsyncIterable<TSource>, other: Promise<any>) { | |
super(); |
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
'use strict'; | |
import * as test from 'tape'; | |
import { of } from '../../dist/cjs/asynciterable/of'; | |
import { race } from '../../dist/cjs/asynciterable/race'; | |
import { hasNext, noNext } from '../asynciterablehelpers'; | |
function delayValue<T>(value: T, time: number) { | |
return new Promise<T>(resolve => setTimeout(() => resolve(value), time)); | |
} |
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
const EventEmitter = require('events').EventEmitter; | |
const fromEventPattern = require('ix/asynciterable/fromeventpattern').fromEventPattern; | |
// Get Async Iterable | |
const e = new EventEmitter(); | |
const ai = fromEventPattern( | |
h => e.addListener('data', h), | |
h => e.removeListener('data', h) | |
); |
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
'use strict'; | |
import { IterableX } from '../iterable'; | |
import { map } from './map'; | |
function makeTuple<TFirst, TSecond>(x: TFirst, y: TSecond): [TFirst, TSecond] { | |
return [x, y]; | |
} | |
class OfEntriesIterable<TSource> extends IterableX<[string, TSource]> { |