bluefeather
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -6,9 +6,8 @@ "use strict"; | ||
}); | ||
// @flow | ||
/** | ||
* Creates a promise that is scheduled to resolve after a set delay. | ||
*/ | ||
/*:: type DelayType = (ms: number) => Promise<void>;*/ | ||
const delay /*: DelayType*/ = ms => { | ||
const delay = ms => { | ||
return new Promise(resolve => { | ||
@@ -21,2 +20,3 @@ setTimeout(() => { | ||
exports.default = delay; | ||
exports.default = delay; | ||
//# sourceMappingURL=delay.js.map |
@@ -34,2 +34,3 @@ 'use strict'; | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
//# sourceMappingURL=index.js.map |
@@ -7,31 +7,19 @@ "use strict"; | ||
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
// @flow | ||
/*:: type CallbackType = (currentValue: any, index: any, values: Iterable<any>) => any;*/ | ||
/** | ||
* Creates a promise that is scheduled to resolve after a set delay. | ||
*/ | ||
/*:: type MapSeriesType = (values: Array<any>, mapper: CallbackType) => Promise<Array<any>>;*/ | ||
const mapSeries /*: MapSeriesType*/ = (() => { | ||
var _ref = _asyncToGenerator(function* (values, mapper) { | ||
const mappedValues = []; | ||
const mapSeries = async (values, mapper) => { | ||
const mappedValues = []; | ||
let index = -1; | ||
let index = -1; | ||
for (const value of values) { | ||
mappedValues.push((yield mapper(value, ++index, values))); | ||
} | ||
for (const value of values) { | ||
mappedValues.push((await mapper(value, ++index, values))); | ||
} | ||
return mappedValues; | ||
}); | ||
return mappedValues; | ||
}; | ||
return function mapSeries(_x, _x2) { | ||
return _ref.apply(this, arguments); | ||
}; | ||
})(); | ||
exports.default = mapSeries; | ||
exports.default = mapSeries; | ||
//# sourceMappingURL=mapSeries.js.map |
@@ -6,24 +6,19 @@ 'use strict'; | ||
}); | ||
// @flow | ||
/** | ||
* @property context Invokes `nodeFunction` using `context` as the calling object. | ||
* @property multipleArguments Makes the resulting promise fulfill with an array of the callback's success value(s). | ||
* Creates a function that when executed returns a promise whose fait depends | ||
* on the callback provided as the last parameter to the wrapped function. | ||
*/ | ||
/*:: type PromisifyOptionsType = {| | ||
context?: any, | ||
multipleArguments?: boolean | ||
|};*/ | ||
/** | ||
* Creates a function that when executed returns a promise whose fait depends | ||
* on the callback provided as the last parameter to the wrapped function. | ||
* @property context Invokes `nodeFunction` using `context` as the calling object. | ||
* @property multipleArguments Makes the resulting promise fulfill with an array of the callback's success value(s). | ||
*/ | ||
/*:: type PromisifyType = (nodeFunction: Function, options?: PromisifyOptionsType) => Function;*/ | ||
const promisify /*: PromisifyType*/ = (nodeFunction, options = {}) => { | ||
const promisify = (nodeFunction, options = {}) => { | ||
const multipleArguments = typeof options.multipleArguments === 'boolean' ? options.multipleArguments : false; | ||
const context = options.context || null; | ||
return (...args /*: Array<any>*/) /*: Promise<any>*/ => { | ||
return (...args) => { | ||
return new Promise((resolve, reject) => { | ||
@@ -51,2 +46,3 @@ const callback = (error, ...results) => { | ||
exports.default = promisify; | ||
exports.default = promisify; | ||
//# sourceMappingURL=promisify.js.map |
@@ -18,5 +18,4 @@ { | ||
"babel-plugin-istanbul": "^4.0.0", | ||
"babel-plugin-transform-async-to-generator": "^6.22.0", | ||
"babel-plugin-transform-es2015-modules-commonjs": "^6.23.0", | ||
"babel-plugin-transform-flow-comments": "^6.22.0", | ||
"babel-plugin-transform-flow-strip-types": "^6.22.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.23.0", | ||
@@ -29,2 +28,3 @@ "babel-preset-env": "^1.1.8", | ||
"flow-bin": "^0.39.0", | ||
"flow-copy-source": "^1.1.0", | ||
"husky": "^0.13.1", | ||
@@ -35,3 +35,3 @@ "nyc": "^10.1.2", | ||
"engines": { | ||
"node": ">7.3.0" | ||
"node": ">7.8.0" | ||
}, | ||
@@ -62,8 +62,8 @@ "keywords": [ | ||
"scripts": { | ||
"build": "NODE_ENV=production babel ./src --out-dir ./dist --copy-files", | ||
"build": "rm -fr ./dist && NODE_ENV=production babel ./src --out-dir ./dist --copy-files --source-maps && flow-copy-source src dist", | ||
"lint": "eslint ./src ./test && flow", | ||
"precommit": "npm run lint && npm run test && npm run build", | ||
"test": "NODE_ENV=development nyc --reporter=text ava --verbose --serial" | ||
"test": "NODE_ENV=test nyc --reporter=text ava --verbose --serial" | ||
}, | ||
"version": "2.0.1" | ||
"version": "2.1.0" | ||
} |
16172
19
157