Comparing version 0.1.2 to 0.1.3
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -8,16 +8,13 @@ Object.defineProperty(exports, "__esModule", { | ||
var _intercept = require('../helpers/intercept'); | ||
var _intercept = _interopRequireDefault(require("../helpers/intercept")); | ||
var _intercept2 = _interopRequireDefault(_intercept); | ||
var _mark = _interopRequireDefault(require("../helpers/mark")); | ||
var _mark = require('../helpers/mark'); | ||
var _mark2 = _interopRequireDefault(_mark); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function cancellable(promise) { | ||
if (_mark2.default.get(promise, 'cancellable')) return promise; | ||
_mark2.default.set(promise, 'cancellable'); | ||
if (_mark.default.get(promise, 'cancellable')) return promise; | ||
_mark.default.set(promise, 'cancellable'); | ||
var cancellable = true; | ||
@@ -37,3 +34,3 @@ promise.cancelled = false; | ||
}); | ||
return (0, _intercept2.default)(promise, function (p) { | ||
return (0, _intercept.default)(promise, function (p) { | ||
return p.then(function (val) { | ||
@@ -40,0 +37,0 @@ return promise.cancelled ? unfulfilled : val; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -8,26 +8,19 @@ Object.defineProperty(exports, "__esModule", { | ||
var _intercept = require('../helpers/intercept'); | ||
var _intercept = _interopRequireDefault(require("../helpers/intercept")); | ||
var _intercept2 = _interopRequireDefault(_intercept); | ||
var _mark = _interopRequireDefault(require("../helpers/mark")); | ||
var _mark = require('../helpers/mark'); | ||
var _deferred = _interopRequireDefault(require("../create/deferred")); | ||
var _mark2 = _interopRequireDefault(_mark); | ||
var _deferred = require('../create/deferred'); | ||
var _deferred2 = _interopRequireDefault(_deferred); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function defer(promise) { | ||
if (_mark2.default.get(promise, 'deferrable')) return promise; | ||
if (_mark.default.get(promise, 'deferrable')) return promise; | ||
_mark2.default.set(promise, 'deferrable'); | ||
var p = (0, _deferred2.default)(); | ||
_mark.default.set(promise, 'deferrable'); | ||
var p = (0, _deferred.default)(); | ||
promise.resolve = p.resolve; | ||
promise.reject = p.reject; | ||
return (0, _intercept2.default)(promise, function (promise) { | ||
return (0, _intercept.default)(promise, function (promise) { | ||
promise.then(function (val) { | ||
@@ -34,0 +27,0 @@ return p.resolve(val); |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -8,10 +8,6 @@ Object.defineProperty(exports, "__esModule", { | ||
var _intercept = require('../helpers/intercept'); | ||
var _intercept = _interopRequireDefault(require("../helpers/intercept")); | ||
var _intercept2 = _interopRequireDefault(_intercept); | ||
var _wait = _interopRequireDefault(require("../create/wait")); | ||
var _wait = require('../create/wait'); | ||
var _wait2 = _interopRequireDefault(_wait); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -25,3 +21,3 @@ | ||
var remaining = Math.max(0, ms - time); | ||
return (0, _wait2.default)(remaining); | ||
return (0, _wait.default)(remaining); | ||
}; | ||
@@ -31,3 +27,3 @@ | ||
return function (promise) { | ||
return (0, _intercept2.default)(promise, function (p) { | ||
return (0, _intercept.default)(promise, function (p) { | ||
return p.then(function (val) { | ||
@@ -34,0 +30,0 @@ return delayer().then(function () { |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,57 +6,51 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
var _cancellable = require('./cancellable'); | ||
Object.defineProperty(exports, 'cancellable', { | ||
Object.defineProperty(exports, "cancellable", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_cancellable).default; | ||
return _cancellable.default; | ||
} | ||
}); | ||
var _deferrable = require('./deferrable'); | ||
Object.defineProperty(exports, 'deferrable', { | ||
Object.defineProperty(exports, "deferrable", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_deferrable).default; | ||
return _deferrable.default; | ||
} | ||
}); | ||
var _delay = require('./delay'); | ||
Object.defineProperty(exports, 'delay', { | ||
Object.defineProperty(exports, "delay", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_delay).default; | ||
return _delay.default; | ||
} | ||
}); | ||
var _status = require('./status'); | ||
Object.defineProperty(exports, 'status', { | ||
Object.defineProperty(exports, "status", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_status).default; | ||
return _status.default; | ||
} | ||
}); | ||
var _timed = require('./timed'); | ||
Object.defineProperty(exports, 'timed', { | ||
Object.defineProperty(exports, "timed", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_timed).default; | ||
return _timed.default; | ||
} | ||
}); | ||
var _timeout = require('./timeout'); | ||
Object.defineProperty(exports, 'timeout', { | ||
Object.defineProperty(exports, "timeout", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_timeout).default; | ||
return _timeout.default; | ||
} | ||
}); | ||
var _cancellable = _interopRequireDefault(require("./cancellable")); | ||
var _deferrable = _interopRequireDefault(require("./deferrable")); | ||
var _delay = _interopRequireDefault(require("./delay")); | ||
var _status = _interopRequireDefault(require("./status")); | ||
var _timed = _interopRequireDefault(require("./timed")); | ||
var _timeout = _interopRequireDefault(require("./timeout")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,16 +6,12 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.STATUSES = undefined; | ||
exports.default = status; | ||
exports.STATUSES = void 0; | ||
var _intercept = require('../helpers/intercept'); | ||
var _intercept = _interopRequireDefault(require("../helpers/intercept")); | ||
var _intercept2 = _interopRequireDefault(_intercept); | ||
var _mark = _interopRequireDefault(require("../helpers/mark")); | ||
var _mark = require('../helpers/mark'); | ||
var _mark2 = _interopRequireDefault(_mark); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
var STATUSES = exports.STATUSES = { | ||
var STATUSES = { | ||
PENDING: 'pending', | ||
@@ -25,12 +21,13 @@ RESOLVED: 'resolved', | ||
}; | ||
exports.STATUSES = STATUSES; | ||
function status(promise) { | ||
if (_mark2.default.get(promise, 'status')) return promise; | ||
if (_mark.default.get(promise, 'status')) return promise; | ||
_mark2.default.set(promise, 'status'); | ||
_mark.default.set(promise, 'status'); | ||
promise.status = STATUSES.PENDING; | ||
promise.value = null; | ||
promise.reason = null; | ||
return (0, _intercept2.default)(promise, function (p) { | ||
return (0, _intercept.default)(promise, function (p) { | ||
return p.then(function (val) { | ||
@@ -37,0 +34,0 @@ promise.status = STATUSES.RESOLVED; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -8,20 +8,16 @@ Object.defineProperty(exports, "__esModule", { | ||
var _intercept = require('../helpers/intercept'); | ||
var _intercept = _interopRequireDefault(require("../helpers/intercept")); | ||
var _intercept2 = _interopRequireDefault(_intercept); | ||
var _mark = _interopRequireDefault(require("../helpers/mark")); | ||
var _mark = require('../helpers/mark'); | ||
var _mark2 = _interopRequireDefault(_mark); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function timed(promise) { | ||
if (_mark2.default.get(promise, 'timed')) return promise; | ||
_mark2.default.set(promise, 'timed'); | ||
if (_mark.default.get(promise, 'timed')) return promise; | ||
_mark.default.set(promise, 'timed'); | ||
promise.time = null; | ||
var init = Date.now(); | ||
return (0, _intercept2.default)(promise, function (p) { | ||
return (0, _intercept.default)(promise, function (p) { | ||
return p.then(function (val) { | ||
@@ -28,0 +24,0 @@ promise.time = Date.now() - init; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -8,18 +8,10 @@ Object.defineProperty(exports, "__esModule", { | ||
var _intercept = require('../helpers/intercept'); | ||
var _intercept = _interopRequireDefault(require("../helpers/intercept")); | ||
var _intercept2 = _interopRequireDefault(_intercept); | ||
var _wait = _interopRequireDefault(require("../create/wait")); | ||
var _wait = require('../create/wait'); | ||
var _cancellable = _interopRequireDefault(require("./cancellable")); | ||
var _wait2 = _interopRequireDefault(_wait); | ||
var _deferrable = _interopRequireDefault(require("./deferrable")); | ||
var _cancellable = require('./cancellable'); | ||
var _cancellable2 = _interopRequireDefault(_cancellable); | ||
var _deferrable = require('./deferrable'); | ||
var _deferrable2 = _interopRequireDefault(_deferrable); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -29,10 +21,8 @@ | ||
return function (promise) { | ||
promise = reason ? (0, _deferrable2.default)(promise) : (0, _cancellable2.default)(promise); | ||
promise = reason ? (0, _deferrable.default)(promise) : (0, _cancellable.default)(promise); | ||
var done = false; | ||
(0, _wait2.default)(ms).then(function () { | ||
(0, _wait.default)(ms).then(function () { | ||
return !done && (reason ? promise.reject(reason) : promise.cancel()); | ||
}); | ||
return (0, _intercept2.default)(promise, function (p) { | ||
return (0, _intercept.default)(promise, function (p) { | ||
return p.then(function (val) { | ||
@@ -39,0 +29,0 @@ return (done = true) && val; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -8,11 +8,8 @@ Object.defineProperty(exports, "__esModule", { | ||
var _mark = require('../helpers/mark'); | ||
var _mark = _interopRequireDefault(require("../helpers/mark")); | ||
var _mark2 = _interopRequireDefault(_mark); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function deferred() { | ||
var _resolve = void 0, | ||
_reject = void 0; | ||
var _resolve, _reject; | ||
@@ -24,3 +21,3 @@ var p = new Promise(function (resolve, reject) { | ||
_mark2.default.set(p, 'deferrable'); | ||
_mark.default.set(p, 'deferrable'); | ||
@@ -27,0 +24,0 @@ p.resolve = _resolve; |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.default = immediate; | ||
function immediate() { | ||
@@ -9,0 +10,0 @@ return new Promise(function (resolve) { |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,48 +6,43 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
var _deferred = require('./deferred'); | ||
Object.defineProperty(exports, 'deferred', { | ||
Object.defineProperty(exports, "deferred", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_deferred).default; | ||
return _deferred.default; | ||
} | ||
}); | ||
var _immediate = require('./immediate'); | ||
Object.defineProperty(exports, 'immediate', { | ||
Object.defineProperty(exports, "immediate", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_immediate).default; | ||
return _immediate.default; | ||
} | ||
}); | ||
var _lazy = require('./lazy'); | ||
Object.defineProperty(exports, 'lazy', { | ||
Object.defineProperty(exports, "lazy", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_lazy).default; | ||
return _lazy.default; | ||
} | ||
}); | ||
var _wait = require('./wait'); | ||
Object.defineProperty(exports, 'wait', { | ||
Object.defineProperty(exports, "wait", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_wait).default; | ||
return _wait.default; | ||
} | ||
}); | ||
var _waitUntil = require('./wait-until'); | ||
Object.defineProperty(exports, 'waitUntil', { | ||
Object.defineProperty(exports, "waitUntil", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_waitUntil).default; | ||
return _waitUntil.default; | ||
} | ||
}); | ||
var _deferred = _interopRequireDefault(require("./deferred")); | ||
var _immediate = _interopRequireDefault(require("./immediate")); | ||
var _lazy = _interopRequireDefault(require("./lazy")); | ||
var _wait = _interopRequireDefault(require("./wait")); | ||
var _waitUntil = _interopRequireDefault(require("./wait-until")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -8,6 +8,4 @@ Object.defineProperty(exports, "__esModule", { | ||
var _intercept = require('../helpers/intercept'); | ||
var _intercept = _interopRequireDefault(require("../helpers/intercept")); | ||
var _intercept2 = _interopRequireDefault(_intercept); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -19,7 +17,6 @@ | ||
}); | ||
var p = void 0; | ||
return (0, _intercept2.default)(promise, function () { | ||
var p; | ||
return (0, _intercept.default)(promise, function () { | ||
return p || (p = new Promise(executor)); | ||
}); | ||
} |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -8,6 +8,4 @@ Object.defineProperty(exports, "__esModule", { | ||
var _wait = require('./wait'); | ||
var _wait = _interopRequireDefault(require("./wait")); | ||
var _wait2 = _interopRequireDefault(_wait); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
@@ -20,3 +18,3 @@ | ||
return Promise.resolve(testCb()).then(function (ans) { | ||
return ans || (0, _wait2.default)(ms).then(function () { | ||
return ans || (0, _wait.default)(ms).then(function () { | ||
return callCb(); | ||
@@ -23,0 +21,0 @@ }); |
@@ -7,2 +7,3 @@ "use strict"; | ||
exports.default = wait; | ||
function wait(ms) { | ||
@@ -9,0 +10,0 @@ return new Promise(function (resolve) { |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -8,10 +8,14 @@ Object.defineProperty(exports, "__esModule", { | ||
var _compose = require('../utils/compose'); | ||
var _compose = _interopRequireDefault(require("../utils/compose")); | ||
var _compose2 = _interopRequireDefault(_compose); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } } | ||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); } | ||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); } | ||
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); } | ||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } } | ||
var INTERCEPT_SYMBOL = Symbol('intercept'); | ||
@@ -32,5 +36,6 @@ var RESPONSE_SYMBOL = Symbol('response'); | ||
var _then = promise.then; | ||
var run = function run() { | ||
var res = promise[RESPONSE_SYMBOL]; | ||
return res || (promise[RESPONSE_SYMBOL] = _compose2.default.apply(undefined, _toConsumableArray(intercept))(Promise.resolve(_then.call(promise, function (x) { | ||
return res || (promise[RESPONSE_SYMBOL] = _compose.default.apply(void 0, _toConsumableArray(intercept))(Promise.resolve(_then.call(promise, function (x) { | ||
return x; | ||
@@ -45,2 +50,3 @@ })))); | ||
}; | ||
promise.catch = function () { | ||
@@ -51,2 +57,3 @@ var _run2; | ||
}; | ||
promise.finally = function () { | ||
@@ -53,0 +60,0 @@ var _run3; |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,2 +6,4 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = exports.MARK_SYMBOL = void 0; | ||
var getDefaults = function getDefaults() { | ||
@@ -17,8 +19,9 @@ return { | ||
var MARK_SYMBOL = exports.MARK_SYMBOL = Symbol('mark'); | ||
exports.default = { | ||
var MARK_SYMBOL = Symbol('mark'); | ||
exports.MARK_SYMBOL = MARK_SYMBOL; | ||
var _default = { | ||
set: function set(promise) { | ||
if (!promise[MARK_SYMBOL]) promise[MARK_SYMBOL] = getDefaults(); | ||
for (var _len = arguments.length, as = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
for (var _len = arguments.length, as = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { | ||
as[_key - 1] = arguments[_key]; | ||
@@ -30,3 +33,2 @@ } | ||
}); | ||
return promise; | ||
@@ -37,2 +39,3 @@ }, | ||
} | ||
}; | ||
}; | ||
exports.default = _default; |
45
index.js
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,7 +6,24 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
var _exportNames = { | ||
series: true, | ||
parallel: true | ||
}; | ||
Object.defineProperty(exports, "series", { | ||
enumerable: true, | ||
get: function get() { | ||
return _series.default; | ||
} | ||
}); | ||
Object.defineProperty(exports, "parallel", { | ||
enumerable: true, | ||
get: function get() { | ||
return _parallel.default; | ||
} | ||
}); | ||
var _create = require('./create'); | ||
var _create = require("./create"); | ||
Object.keys(_create).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -20,6 +37,7 @@ enumerable: true, | ||
var _compose = require('./compose'); | ||
var _compose = require("./compose"); | ||
Object.keys(_compose).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -33,6 +51,7 @@ enumerable: true, | ||
var _utils = require('./utils'); | ||
var _utils = require("./utils"); | ||
Object.keys(_utils).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
Object.defineProperty(exports, key, { | ||
@@ -46,20 +65,6 @@ enumerable: true, | ||
var _series = require('./series'); | ||
var _series = _interopRequireDefault(require("./series")); | ||
Object.defineProperty(exports, 'series', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_series).default; | ||
} | ||
}); | ||
var _parallel = _interopRequireDefault(require("./parallel")); | ||
var _parallel = require('./parallel'); | ||
Object.defineProperty(exports, 'parallel', { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_parallel).default; | ||
} | ||
}); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -36,3 +36,6 @@ const scripts = (x) => ({ scripts: x }); | ||
update: 'npm update --save/save-dev && npm outdated', | ||
clean: `${exit0(`shx rm -r ${OUT_DIR} coverage`)} && shx rm -rf node_modules`, | ||
clean: series([ | ||
exit0(`shx rm -r ${OUT_DIR} ${DOCS_DIR} coverage`), | ||
'shx rm -rf node_modules' | ||
]), | ||
docs: series([ | ||
@@ -39,0 +42,0 @@ 'nps lint.typings', |
{ | ||
"name": "promist", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"author": "Rafa Mel", | ||
@@ -20,3 +20,2 @@ "description": "A dependable Promises and async utility belt", | ||
"scripts": { | ||
"precommit": "cross-env MSG=\"Committing in:\" nps validate", | ||
"start": "npm run watch", | ||
@@ -52,12 +51,14 @@ "build": "nps build", | ||
"devDependencies": { | ||
"@babel/cli": "^7.0.0", | ||
"@babel/core": "^7.0.0", | ||
"@babel/plugin-proposal-class-properties": "^7.0.0", | ||
"@babel/plugin-proposal-decorators": "^7.0.0", | ||
"@babel/plugin-proposal-object-rest-spread": "^7.0.0", | ||
"@babel/preset-env": "^7.0.0", | ||
"@babel/register": "^7.0.0", | ||
"@types/jest": "^23.3.9", | ||
"babel-cli": "^6.26.0", | ||
"babel-eslint": "^8.2.6", | ||
"babel-core": "^7.0.0-bridge.0", | ||
"babel-eslint": "^10.0.1", | ||
"babel-jest": "^23.6.0", | ||
"babel-plugin-module-resolver": "^3.1.1", | ||
"babel-plugin-transform-class-properties": "^6.24.1", | ||
"babel-plugin-transform-decorators-legacy": "^1.3.5", | ||
"babel-plugin-transform-object-rest-spread": "^6.26.0", | ||
"babel-preset-env": "^1.7.0", | ||
"babel-register": "^6.26.0", | ||
"concurrently": "^3.6.1", | ||
"coveralls": "^3.0.2", | ||
@@ -68,3 +69,3 @@ "cross-env": "^5.2.0", | ||
"eslint-config-standard": "^12.0.0", | ||
"eslint-import-resolver-babel-module": "^4.0.0", | ||
"eslint-import-resolver-babel-module": "^5.0.0-beta.1", | ||
"eslint-plugin-babel": "^5.3.0", | ||
@@ -78,3 +79,3 @@ "eslint-plugin-import": "^2.14.0", | ||
"eslint-restricted-globals": "^0.2.0", | ||
"husky": "^0.14.3", | ||
"husky": "^1.2.0", | ||
"jake": "^8.0.19", | ||
@@ -84,3 +85,3 @@ "jest-cli": "^23.6.0", | ||
"nps": "^5.9.3", | ||
"onchange": "^4.1.0", | ||
"onchange": "^5.2.0", | ||
"prettier": "^1.15.2", | ||
@@ -104,3 +105,8 @@ "shx": "^0.3.2", | ||
] | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"pre-commit": "cross-env MSG=\"Committing in:\" nps validate" | ||
} | ||
} | ||
} |
@@ -10,2 +10,4 @@ "use strict"; | ||
exports.each = each; | ||
exports.default = void 0; | ||
function map(arr, fn) { | ||
@@ -19,3 +21,2 @@ return Promise.all(arr).then(function (resArr) { | ||
var filterVal = {}; | ||
return Promise.all(arr).then(function (resArr) { | ||
@@ -50,3 +51,3 @@ return Promise.all(resArr.map(function (x, i) { | ||
exports.default = { | ||
var _default = { | ||
map: map, | ||
@@ -56,2 +57,3 @@ filter: filter, | ||
each: each | ||
}; | ||
}; | ||
exports.default = _default; |
@@ -23,24 +23,24 @@ # Promist | ||
* [*Promises*:](#Promises) There are *create* and *compose* functions: | ||
* [*Create* functions](#Create-functions) return a newly formed promise. | ||
* [`wait()`](#waitms-Number-Promise) | ||
* [`waitUntil()`](#waitUntiltestCb-Function-ms-Number-Promise) | ||
* [`deferred()`](#deferred-Promise) | ||
* [`lazy()`](#lazyexecutor-Function-Promise) | ||
* [`immediate()`](#immediate-Promise) | ||
* [*Compose* functions](#Compose-functions) mutate an input promise in order to provide some added functionality. They can be chained via [`compose()`.](#composefns-Function) | ||
* [`deferrable()`](#deferrablepromise-Promise-Promise) | ||
* [`cancellable()`](#cancellablepromise-Promise-Promise) | ||
* [`status()`](#statuspromise-Promise-Promise) | ||
* [`timed()`](#timedpromise-Promise-Promise) | ||
* [`delay()`](#delayms-Number-delayRejection-boolean-Function) | ||
* [`timeout()`](#timeoutms-Number-reason-any-Function) | ||
* There are also some [utility functions.](#Utils) | ||
* [`compose()`](#composefns-Function-Function) | ||
* [`isPromise()`](#isPromiseobject-any-boolean) | ||
* [*Collections*:](#Collections) Handled either in *parallel* or *series.* | ||
* [`map()`](#maparr-Promise-callback-Function-Promise) | ||
* [`filter()`](#filterarr-Promise-callback-Function-Promise) | ||
* [`reduce()`](#reducearr-Promise-callback-Function-initialValue-any-Promise) | ||
* [`each()`](#eacharr-Promise-callback-Function-Promise) | ||
* [*Promises*:](#promises) There are *create* and *compose* functions: | ||
* [*Create* functions](#create-functions) return a newly formed promise. | ||
* [`wait()`](#waitms-number-promise) | ||
* [`waitUntil()`](#waituntiltestcb-function-ms-number-promise) | ||
* [`deferred()`](#deferred-promise) | ||
* [`lazy()`](#lazyexecutor-function-promise) | ||
* [`immediate()`](#immediate-promise) | ||
* [*Compose* functions](#compose-functions) mutate an input promise in order to provide some added functionality. They can be chained via [`compose()`.](#composefns-function) | ||
* [`deferrable()`](#deferrablepromise-promise-promise) | ||
* [`cancellable()`](#cancellablepromise-promise-promise) | ||
* [`status()`](#statuspromise-promise-promise) | ||
* [`timed()`](#timedpromise-promise-promise) | ||
* [`delay()`](#delayms-number-delayrejection-boolean-function) | ||
* [`timeout()`](#timeoutms-number-reason-any-function) | ||
* There are also some [utility functions.](#utils) | ||
* [`compose()`](#composefns-function-function) | ||
* [`isPromise()`](#ispromiseobject-any-boolean) | ||
* [*Collections*:](#collections) Handled either in *parallel* or *series.* | ||
* [`map()`](#maparr-promise-callback-function-promise) | ||
* [`filter()`](#filterarr-promise-callback-function-promise) | ||
* [`reduce()`](#reducearr-promise-callback-function-initialvalue-any-promise) | ||
* [`each()`](#eacharr-promise-callback-function-promise) | ||
@@ -139,3 +139,3 @@ You can either `import` directly from the package root (as shown in the examples below), or: | ||
* They might not work adecuately if you're using non-standard methods for resolution other than `promise.then()`, `promise.catch()`, or `promise.finally()`. | ||
* They can be chained via [`compose()`.](#composefns-Function) | ||
* They can be chained via [`compose()`.](#composefns-function) | ||
@@ -142,0 +142,0 @@ #### `deferrable(promise: Promise): Promise` |
@@ -10,5 +10,6 @@ "use strict"; | ||
exports.each = each; | ||
exports.default = void 0; | ||
function map(arr, cb) { | ||
var ans = []; | ||
return arr.reduce(function (acc, x, i) { | ||
@@ -29,3 +30,2 @@ return acc.then(function () { | ||
var ans = []; | ||
return arr.reduce(function (acc, x, i) { | ||
@@ -68,3 +68,3 @@ return acc.then(function () { | ||
exports.default = { | ||
var _default = { | ||
map: map, | ||
@@ -74,2 +74,3 @@ filter: filter, | ||
each: each | ||
}; | ||
}; | ||
exports.default = _default; |
@@ -7,4 +7,5 @@ "use strict"; | ||
exports.default = compose; | ||
function compose() { | ||
for (var _len = arguments.length, fns = Array(_len), _key = 0; _key < _len; _key++) { | ||
for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) { | ||
fns[_key] = arguments[_key]; | ||
@@ -17,8 +18,7 @@ } | ||
if (fns.length === 1) return fns[0]; | ||
return fns.reduce(function (a, b) { | ||
return function () { | ||
return a(b.apply(undefined, arguments)); | ||
return a(b.apply(void 0, arguments)); | ||
}; | ||
}); | ||
} |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,21 +6,19 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
var _compose = require('./compose'); | ||
Object.defineProperty(exports, 'compose', { | ||
Object.defineProperty(exports, "compose", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_compose).default; | ||
return _compose.default; | ||
} | ||
}); | ||
var _isPromise = require('./is-promise'); | ||
Object.defineProperty(exports, 'isPromise', { | ||
Object.defineProperty(exports, "isPromise", { | ||
enumerable: true, | ||
get: function get() { | ||
return _interopRequireDefault(_isPromise).default; | ||
return _isPromise.default; | ||
} | ||
}); | ||
var _compose = _interopRequireDefault(require("./compose")); | ||
var _isPromise = _interopRequireDefault(require("./is-promise")); | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
@@ -1,2 +0,2 @@ | ||
'use strict'; | ||
"use strict"; | ||
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { | ||
}); | ||
exports.default = isPromise; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | ||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } | ||
exports.default = isPromise; | ||
function isPromise(obj) { | ||
return !!(obj && ((typeof obj === 'undefined' ? 'undefined' : _typeof(obj)) === 'object' || typeof obj === 'function') && typeof obj.then === 'function'); | ||
return !!(obj && (_typeof(obj) === 'object' || typeof obj === 'function') && typeof obj.then === 'function'); | ||
} |
Sorry, the diff of this file is not supported yet
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
41576
847
39