Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cspromise

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cspromise

CSP constructs for JavaScript Promises

  • 0.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

CSPromise Build Status Coverage Status

CSPromise implements CSP constructs (found in e.g. Go, Clojure, etc.) on top of JavaScript (Node.js or browser) Promises.

Features

  • Easy. Designed (but not required!) to be used with Promise-based coroutines (e.g. async/await, Bluebird, co).
  • Standard. Drop-in alongside existing Promises (native or polyfilled).
  • Fast. As performant as a Promise.

API

var csp = require('cspromise')

Returns the module.

new csp.Channel(size=0)

Instantiates a new CSP channel with an optional fixed size.

Chan.prototype.put(val, block=true)

Put an item in the channel, optionally blocking until space is available, and then, resolve. If block == false and no space is available, reject.

Chan.prototype.take([block=true])

Take an item from the channel, optionally blocking until a value is sent, and then, resolve. If block == false and no space is available, reject.

Chan.prototype.close()

Close channel. Receiving or sending on this channel will reject.

FAQ

Why CSP?

CSP makes it easy to communicate between Promise coroutines and moreover, "control flows". Read more on why CSP matters.

Why not use js-csp?

js-csp and CSPromise align conceptually, but js-csp invents its own asynchronous control flow, leaving a community of Promise-based code behind.

FAQs

Package last updated on 04 Sep 2016

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc