beesperester / sanctuary-processP

add async / await functionality to sanctuary

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sanctuary-processP

Adds synchronous and async / await process functionality to sanctuary. A process waits for all of its tasks to be finished.

Actions Status Actions Status Run on Repl.it

Example

// Import sanctuary.
const Sanctuary = require('sanctuary');

// Import processP and env from sanctuary-processP
const { processP, env } = require('sanctuary-processP');


// Setup Sanctuary environment to include sanctuary-processP Promise type.
const S = Sanctuary.create({
  checkTypes: true,
  env: Sanctuary.env.concat(env)
});


// create list of processes
const processes = processP([
  (x => Promise.resolve(x + 1)),
  S.add(2)
]);


// enjoy
processes(1).then(console.log); // should output [2, 3]

About

add async / await functionality to sanctuary


Languages

Language:JavaScript 100.0%