Socket
Socket
Sign inDemoInstall

await-timeout

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.6.0 to 1.0.0

40

package.json
{
"name": "await-timeout",
"version": "0.6.0",
"version": "1.0.0",
"description": "A Promise-based API for setTimeout / clearTimeout",

@@ -16,12 +16,9 @@ "author": {

},
"main": "dist/es6.js",
"main": "src/index.js",
"scripts": {
"code": "eslint src test scripts rollup.config.js",
"build": "rollup -c",
"test": "npm run build && npm run test-lib",
"test-lib": "mocha test/setup test/specs",
"test-es5": "LIB_PATH=../dist/es5 npm run test-lib",
"test-installed": "node scripts/install-local && LIB_PATH=../.installed/node_modules/await-timeout npm run test-lib",
"ci": "npm run code && npm test",
"prerelease": "npm run code && npm test && npm run test-es5 && npm run test-installed",
"lint": "eslint src test scripts",
"test": "mocha test/setup test/specs",
"test-installed": "node scripts/install-local && LIB_PATH=../.installed/node_modules/await-timeout npm t",
"ci": "npm run lint && npm test",
"prerelease": "npm run lint && npm test && npm run test-installed",
"release": "npm version $VER && npm publish",

@@ -35,25 +32,16 @@ "postrelease": "git push --follow-tags --no-verify",

"pre-commit": "lint-staged && npm test",
"pre-push": "npm run code && npm test"
"pre-push": "npm run lint && npm test"
}
},
"lint-staged": {
"linters": {
"**/*.js": "eslint"
},
"ignore": [
"dist"
]
"**/*.js": "eslint"
},
"devDependencies": {
"@babel/core": "^7.4.5",
"@babel/preset-env": "^7.4.5",
"assert-rejects": "^1.0.0",
"eslint": "^5.16.0",
"husky": "^2.2.0",
"eslint": "^6.6.0",
"husky": "^3.1.0",
"install-local": "^1.0.0",
"lint-staged": "^8.1.6",
"mocha": "^6.1.4",
"rollup": "^1.11.3",
"rollup-plugin-babel": "^4.3.3",
"sinon": "^7.3.2"
"lint-staged": "^9.4.3",
"mocha": "^6.2.2",
"sinon": "^7.5.0"
},

@@ -60,0 +48,0 @@ "keywords": [

@@ -5,5 +5,13 @@ /**

import {promiseFinally, toError} from './utils';
const {promiseFinally, toError} = require('./utils');
class Timeout {
module.exports = class Timeout {
static set(delay, rejectReason) {
return new Timeout().set(delay, rejectReason);
}
static wrap(promise, delay, rejectReason) {
return new Timeout().wrap(promise, delay, rejectReason);
}
constructor() {

@@ -34,3 +42,6 @@ this._id = null;

const timer = this.set(delay, rejectReason);
return Promise.race([wrappedPromise, timer]);
return Promise.race([
wrappedPromise,
timer
]);
}

@@ -43,12 +54,2 @@

}
}
Timeout.set = function (delay, rejectReason) {
return new Timeout().set(delay, rejectReason);
};
Timeout.wrap = function (promise, delay, rejectReason) {
return new Timeout().wrap(promise, delay, rejectReason);
};
export default Timeout;

@@ -1,2 +0,2 @@

export function promiseFinally(promise, fn) {
exports.promiseFinally = (promise, fn) => {
const success = result => {

@@ -11,3 +11,3 @@ fn();

return Promise.resolve(promise).then(success, error);
}
};

@@ -19,5 +19,5 @@ /**

*/
export function toError(value) {
exports.toError = value => {
value = typeof value === 'function' ? value() : value;
return typeof value === 'string' ? new Error(value) : value;
}
};

@@ -6,2 +6,1 @@ global.assert = require('assert');

global.sleep = ms => new Promise(r => setTimeout(r, ms));
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