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

p-forever

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

p-forever - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

15

index.js
'use strict';
const symbolEnd = Symbol('pForever.end');
module.exports = function loop(fn, prevVal) {
return Promise.resolve(prevVal).then(fn).then(x => x !== symbolEnd && loop(fn, x));
};
module.exports = (fn, initVal) => new Promise((resolve, reject) => {
const loop = prevVal => Promise.resolve(prevVal).then(fn).then(fnRetVal => {
if (fnRetVal === symbolEnd) {
resolve();
return;
}
loop(fnRetVal);
}).catch(reject);
loop(initVal);
});
module.exports.end = symbolEnd;

97

package.json
{
"name": "p-forever",
"version": "1.0.0",
"description": "Run promise-returning & async functions repeatedly until you end it",
"license": "MIT",
"repository": "sindresorhus/p-forever",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"promise",
"forever",
"infinitely",
"infinite",
"while",
"whilst",
"repeat",
"repeatedly",
"recursive",
"recursion",
"times",
"number",
"count",
"loop",
"iterate",
"serial",
"serially",
"async",
"await",
"promises",
"bluebird"
],
"devDependencies": {
"ava": "*",
"delay": "^1.3.1",
"xo": "*"
},
"xo": {
"esnext": true
}
"name": "p-forever",
"version": "1.0.1",
"description": "Run promise-returning & async functions repeatedly until you end it",
"license": "MIT",
"repository": "sindresorhus/p-forever",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"engines": {
"node": ">=4"
},
"scripts": {
"test": "xo && ava"
},
"files": [
"index.js"
],
"keywords": [
"promise",
"forever",
"infinitely",
"infinite",
"while",
"whilst",
"repeat",
"repeatedly",
"recursive",
"recursion",
"times",
"number",
"count",
"loop",
"iterate",
"serial",
"serially",
"async",
"await",
"promises",
"bluebird"
],
"devDependencies": {
"ava": "*",
"delay": "^2.0.0",
"xo": "*"
}
}

Sorry, the diff of this file is not supported yet

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