promise-delay
Advanced tools
Comparing version 1.0.1 to 2.0.0
@@ -1,5 +0,4 @@ | ||
try { | ||
// optional dependency on polyfill-promise | ||
global.Promise = global.Promise || require('polyfill-promise') | ||
} finally {} | ||
if (!global.Promise) { | ||
throw new Error('No Promise found, please install `polyfill-promise`') | ||
} | ||
@@ -12,5 +11,4 @@ function promiseDelay (delay, val) { | ||
}) | ||
} | ||
module.exports = promiseDelay |
{ | ||
"name": "promise-delay", | ||
"author": "jden <jason@denizac.org>", | ||
"version": "1.0.1", | ||
"version": "2.0.0", | ||
"engines": { | ||
"node": ">=0.12" | ||
}, | ||
"description": "like Promise.cast with a delay in milliseconds", | ||
@@ -13,2 +16,3 @@ "keywords": [ | ||
"scripts": { | ||
"pretest": "standard", | ||
"test": "mochi" | ||
@@ -19,8 +23,6 @@ }, | ||
"readmeFilename": "README.md", | ||
"optionalDependencies": { | ||
"polyfill-promise": "~4.0.1" | ||
}, | ||
"devDependencies": { | ||
"mochi": "0.3.0" | ||
"mochi": "0.3.0", | ||
"standard": "^6.0.7" | ||
} | ||
} |
# promise-delay | ||
like Promise.cast with a delay in milliseconds | ||
[![Circle CI](https://circleci.com/gh/jden/node-promise-delay.svg?style=svg)](https://circleci.com/gh/jden/node-promise-delay) | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) | ||
**Note**: For node 0.10 support, use promise-delay@1.x to include [polyfill-promise](http://npm.im/polyfill-promise) | ||
## usage | ||
@@ -5,0 +11,0 @@ ```js |
@@ -1,11 +0,11 @@ | ||
var mochi = require('mochi') | ||
/* globals describe, it */ | ||
var expect = require('mochi').expect | ||
describe('promise-delay', function () { | ||
var promiseDelay = require('../') | ||
it('delays a promise', function (end) { | ||
var start = Date.now() | ||
promiseDelay(100, Promise.cast(10)) | ||
promiseDelay(100, Promise.resolve(10)) | ||
.then(function (val) { | ||
@@ -15,3 +15,3 @@ val.should.equal(10) | ||
elapsed.should.be.within(90, 110) | ||
expect(elapsed).to.be.within(90, 110) | ||
}) | ||
@@ -22,10 +22,8 @@ .then(end, end) | ||
it('casts', function (end) { | ||
promiseDelay(10, 'hi') | ||
.then(function (val) { | ||
val.should.equal('hi') | ||
expect(val).to.equal('hi') | ||
}) | ||
.then(end, end) | ||
}) | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3162
0
51
2