Comparing version 1.0.2 to 1.0.3
@@ -5,3 +5,3 @@ var noop = function noop() {}; | ||
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | ||
var context = arguments[2]; | ||
var context = arguments.length > 2 ? arguments[2] : undefined; | ||
@@ -16,8 +16,8 @@ if (typeof func !== 'function') { | ||
var isRun = void 0; | ||
var promise = void 0; | ||
var pendding = void 0; | ||
var resolve = void 0; | ||
var reject = void 0; | ||
var timer = void 0; | ||
var isRun; | ||
var promise; | ||
var pendding; | ||
var resolve; | ||
var reject; | ||
var timer; | ||
var q = []; | ||
@@ -39,3 +39,3 @@ var result = []; | ||
clearTimeout(timer); | ||
resolve([].concat(result)); | ||
resolve(result.concat()); | ||
initialize(); | ||
@@ -59,5 +59,6 @@ } | ||
var _run = function _run() { | ||
var _run = function run() { | ||
if (!isRun) { | ||
isRun = true; | ||
if (pendding) { | ||
@@ -70,10 +71,11 @@ pendding = false; | ||
} | ||
return promise; | ||
}; | ||
var _add = function _add(args) { | ||
var _add = function add(args) { | ||
return q.push(args); | ||
}; | ||
var _stop = function _stop() { | ||
var _stop = function stop() { | ||
clearTimeout(timer); | ||
@@ -83,4 +85,5 @@ isRun = false; | ||
var _clear = function _clear() { | ||
var _clear = function clear() { | ||
_stop(); | ||
reject(new Error('Canceled queue executor.')); | ||
@@ -91,3 +94,2 @@ initialize(); | ||
initialize(); | ||
return { | ||
@@ -98,3 +100,3 @@ run: function run() { | ||
add: function add() { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
@@ -106,3 +108,3 @@ } | ||
push: function push() { | ||
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
@@ -112,2 +114,3 @@ } | ||
_add(args); | ||
return _run(); | ||
@@ -117,2 +120,3 @@ }, | ||
if (isRun) pendding = true; | ||
_stop(); | ||
@@ -119,0 +123,0 @@ }, |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,2 +6,4 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = void 0; | ||
var noop = function noop() {}; | ||
@@ -11,3 +13,3 @@ | ||
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; | ||
var context = arguments[2]; | ||
var context = arguments.length > 2 ? arguments[2] : undefined; | ||
@@ -22,8 +24,8 @@ if (typeof func !== 'function') { | ||
var isRun = void 0; | ||
var promise = void 0; | ||
var pendding = void 0; | ||
var resolve = void 0; | ||
var reject = void 0; | ||
var timer = void 0; | ||
var isRun; | ||
var promise; | ||
var pendding; | ||
var resolve; | ||
var reject; | ||
var timer; | ||
var q = []; | ||
@@ -45,3 +47,3 @@ var result = []; | ||
clearTimeout(timer); | ||
resolve([].concat(result)); | ||
resolve(result.concat()); | ||
initialize(); | ||
@@ -65,5 +67,6 @@ } | ||
var _run = function _run() { | ||
var _run = function run() { | ||
if (!isRun) { | ||
isRun = true; | ||
if (pendding) { | ||
@@ -76,10 +79,11 @@ pendding = false; | ||
} | ||
return promise; | ||
}; | ||
var _add = function _add(args) { | ||
var _add = function add(args) { | ||
return q.push(args); | ||
}; | ||
var _stop = function _stop() { | ||
var _stop = function stop() { | ||
clearTimeout(timer); | ||
@@ -89,4 +93,5 @@ isRun = false; | ||
var _clear = function _clear() { | ||
var _clear = function clear() { | ||
_stop(); | ||
reject(new Error('Canceled queue executor.')); | ||
@@ -97,3 +102,2 @@ initialize(); | ||
initialize(); | ||
return { | ||
@@ -104,3 +108,3 @@ run: function run() { | ||
add: function add() { | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
@@ -112,3 +116,3 @@ } | ||
push: function push() { | ||
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { | ||
args[_key2] = arguments[_key2]; | ||
@@ -118,2 +122,3 @@ } | ||
_add(args); | ||
return _run(); | ||
@@ -123,2 +128,3 @@ }, | ||
if (isRun) pendding = true; | ||
_stop(); | ||
@@ -135,2 +141,3 @@ }, | ||
exports.default = cueue; | ||
var _default = cueue; | ||
exports.default = _default; |
{ | ||
"name": "cueue", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Tiny, Easy queueing on Promise based.", | ||
@@ -27,3 +27,3 @@ "main": "lib/index.js", | ||
"require": [ | ||
"babel-register" | ||
"@babel/register" | ||
] | ||
@@ -39,15 +39,17 @@ }, | ||
"build": "npm run build:commonjs && npm run build:es", | ||
"prepublish": "npm run lint && npm test && npm run build" | ||
"prepublishOnly": "npm run lint && npm test && npm run build" | ||
}, | ||
"devDependencies": { | ||
"ava": "^0.19.1", | ||
"babel-cli": "^6.24.1", | ||
"babel-eslint": "^7.2.3", | ||
"babel-preset-es2015": "^6.24.1", | ||
"coveralls": "^2.13.1", | ||
"eslint": "^4.0.0", | ||
"eslint-plugin-ava": "^4.2.1", | ||
"eslint-plugin-babel": "^4.1.1", | ||
"nyc": "^11.0.2" | ||
"@babel/cli": "^7.0.0-beta.39", | ||
"@babel/core": "^7.0.0-beta.39", | ||
"@babel/preset-es2015": "^7.0.0-beta.39", | ||
"@babel/register": "^7.0.0-beta.39", | ||
"ava": "^1.0.0-beta.1", | ||
"babel-eslint": "^8.2.1", | ||
"coveralls": "^3.0.0", | ||
"eslint": "^4.17.0", | ||
"eslint-plugin-ava": "^4.5.0", | ||
"eslint-plugin-babel": "^4.1.2", | ||
"nyc": "^11.4.1" | ||
} | ||
} |
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
8404
206
11