JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 84
  • Score
    100M100P100Q72710F
  • License ISC

Async versions of Ramda's pipe and compose functions

Package Exports

  • ramda-async

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ramda-async) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ramda-async

Async versions of Ramda's pipe and compose functions

Example usage

import { pipeAsync, mapAllAsync } from 'ramda-async';
import { reduce, map, prop } from 'ramda';

pipeAsync(
  // [string] -> Promise([response])
  mapAllAsync(fetch),
  // Promise([response]) -> Promise([object])
  mapAllAsync(r => r.json()),
  // Promise([object]) -> Promise([number])
  map(prop('total_count')),
  // Promise([number]) -> 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

Functions

pipeAsync(...transformFunctions)(value)

Wraps the input value with a promise and pipes it through the transformationFunctions.

composeAsync(...transformFunctions)(value)

Wraps the input value with a promise and sends it through a function that is composed out of transformationFunctions.

mapAllAsync(transformFunction)(value)

Maps the value to the transformFunction and wraps the result with Promise.all.