This file contains hidden or 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
type Arity1<A, B> = (a: A) => Promise<B>; | |
function asyncPipe<A, B>(f: Arity1<A, B>): Arity1<A, B>; | |
function asyncPipe<A, B, C> (g: Arity1<A, B>, f: Arity1<B, C>): Arity1<A, C>; | |
function asyncPipe<A, B, C, D> (h: Arity1<A, B>, g: Arity1<B, C>, f: Arity1<C, D>): Arity1<A, D>; | |
function asyncPipe<A, B, C, D, E> (i: Arity1<A, B>, h: Arity1<B, C>, g: Arity1<C, D>, f: Arity1<D, E>): Arity1<A, E>; | |
function asyncPipe<A, B, C, D, E, F> (j: Arity1<A, B>, i: Arity1<B, C>, h: Arity1<C, D>, g: Arity1<D, E>, f: Arity1<E, F>): Arity1<A, F>; | |
export default function asyncPipe (...fns) { | |
return x => fns.reduce(async (y, f) => f(await y), x); |
This file contains hidden or 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 React from 'react'; | |
import PropTypes from 'prop-types'; | |
const propTypes = { | |
count: PropTypes.number.isRequired, | |
onIncrement: PropTypes.func.isRequired, | |
onDecrement: PropTypes.func.isRequired, | |
}; | |
const Counter = ({ count, onIncrement, onDecrement }) => ( |
This file contains hidden or 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 { rxObserver } = require('api/v0.3'); | |
const { interval, from, timer, of } = require('rxjs'); | |
const { take, bufferCount, concatMap, delay, first, mergeMap, map, throttleTime, ignoreElements, startWith } = require('rxjs/operators'); | |
const spaceTime = time => concatMap(value => | |
of(value).pipe( | |
delay(time) | |
) | |
); |
OlderNewer