@erboladaiorg/esse-iusto-beatae v4.6.85
@erboladaiorg/esse-iusto-beatae
Provides pipeAsync
and traversePromises
functions that play well with the rest of Ramda ecosystem. Now also plays "okish" with TypeScript.
Install
npm install @erboladaiorg/esse-iusto-beatae
Example usage
import { pipeAsync, traversePromises } from '@erboladaiorg/esse-iusto-beatae';
import { reduce, map, prop } from 'ramda';
pipeAsync(
// string[] -> Promise<Response>[]
map(fetch),
// Promise<Response>[] -> Promise<Response[]>
traversePromises,
// Promise<Response[]> -> Promise<object>[]
map(r => r.json()),
// Promise<object>[] -> Promise<object[]>
traversePromises,
// Promise<object[]> -> Promise<number[]>
map(prop('total_count')),
// Promise<number[]> -> Promise<number>
reduce((r, c) => r + c , 0),
)([
"https://api.github.com/search/repositories?q=ramda",
"https://api.github.com/search/repositories?q=react",
])
// Prints total number of repositories found by two queries above
.then(console.log);
You can run the example here
Api
pipeAsync(...steps)(initialValue)
Performs left-to-right function composition of all the steps, automatically lifts the initial value to a promise and pipes it through the composed steps.
traversePromises(arrayOfPromises)
Wraps the array of promises with Promise.all
, so it traverses the types like this:
declare function traverse<A>(arrayOfPromises: Promise<A>[]): Promise<A[]>
Sponsor
This package is sponsored by ScreenManager - digital signage platform.
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
12 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago