falcor-observable
Version:
An Observable implementation compatible with the Falcor DataSource API. Avoids try/catch.
16 lines (12 loc) • 351 B
JavaScript
// @flow
;
import type { OperatorFunction } from "../es-observable";
const { reduce } = require("./reduce");
function toArrayReducer<T>(arr: T[], item: T, index: number): T[] {
arr.push(item);
return arr;
}
function toArray<T, E>(): OperatorFunction<T, T[], E> {
return reduce(toArrayReducer, []);
}
module.exports = { toArray };