🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

common-promises

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

common-promises

Common promise functions

latest
Source
npmnpm
Version
0.0.4
Version published
Weekly downloads
13
333.33%
Maintainers
1
Weekly downloads
 
Created
Source

Description

Promise functions useful across projects.

Common promise functions including:

  • show: put value to console
  • ignore: put value in bit bucket

Example:

var commonp = require("common-promises")
    p       = ...;

p
    .then(hardWork)
    .then(commonp.show)    // inspect the result
    .then(secretWork)
    .then(commonp.ignore)  // don't leak the secrets 
    .done();

Promise value holder

Tap into your promise chain and re-introduce the value as often as needed downstream.

Example:

var commonp = require("common-promises")
    p       = ...,
    v;

v = commonp.createCapture();

p
  .then(computeSomething)
  .then(v.assign)          // capture the promise value
  .then(doThing1)          // do something with the value
  .then(v.use)             // re-introduce the captured value
  .then(doThing2)          // do something else with the value
  .then(v.use)             // re-introduce it as many times as you wish
  .then(doThing3)
  .done();

Keywords

q

FAQs

Package last updated on 31 Dec 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts