Socket
Socket
Sign inDemoInstall

p-cancelable

Package Overview
Dependencies
0
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.1 to 1.0.0

6

package.json
{
"name": "p-cancelable",
"version": "0.5.1",
"version": "1.0.0",
"description": "Create a promise that can be canceled",

@@ -42,4 +42,4 @@ "license": "MIT",

"devDependencies": {
"ava": "*",
"delay": "^3.0.0",
"ava": "^0.25.0",
"delay": "^4.1.0",
"promise.prototype.finally": "^3.1.0",

@@ -46,0 +46,0 @@ "xo": "^0.23.0"

@@ -60,3 +60,5 @@ # p-cancelable [![Build Status](https://travis-ci.org/sindresorhus/p-cancelable.svg?branch=master)](https://travis-ci.org/sindresorhus/p-cancelable)

```js
const cancelable = new PCancelable((resolve, reject, onCancel) => {
const PCancelable = require('p-cancelable');
const cancelablePromise = new PCancelable((resolve, reject, onCancel) => {
const job = new Job();

@@ -72,3 +74,3 @@

promise.cancel(); // Doesn't throw an error
cancelablePromise.cancel(); // Doesn't throw an error
```

@@ -115,2 +117,4 @@

```js
const PCancelable = require('p-cancelable');
const fn = PCancelable.fn((input, onCancel) => {

@@ -126,7 +130,7 @@ const job = new Job();

const promise = fn('input'); //=> PCancelable
const cancelablePromise = fn('input'); //=> PCancelable
// …
promise.cancel();
cancelablePromise.cancel();
```

@@ -133,0 +137,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc