Skip to content

Commit

Permalink
chore: add index.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
afeiship committed Oct 10, 2022
1 parent 69e7f75 commit fe7aa9b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
3 changes: 2 additions & 1 deletion .release-it.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
]
},
"github": {
"release": true
"release": true,
"proxy": "http://127.0.0.1:9090"
}
}
3 changes: 3 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
interface NxStatic {
promiseSeries: (tasks: Promise<any>[], initial: any) => Promise<any>;
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"gulp-uglify": "^3.0.2",
"jest": "^26.6.3",
"prettier": "^2.2.1",
"release-it": "^14.2.2",
"release-it": "^15.5.0",
"uglify-js": "3.12.4",
"uglify-save-license": "^0.4.1"
},
Expand All @@ -45,4 +45,4 @@
"promise",
"series"
]
}
}
6 changes: 3 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
var MSG_ERR = 'promise.series only accepts an array of functions';
var NUM = 'number';

nx.promiseSeries = function(inTasks, inInitial) {
nx.promiseSeries = function (inTasks, inInitial) {
if (!typeof inTasks.length === NUM) {
return Promise.reject(new TypeError(MSG_ERR));
}
return inTasks.reduce(function(current, next) {
return current.then(next);
return inTasks.reduce(function (res, next) {
return res.then(next);
}, Promise.resolve(inInitial));
};

Expand Down

0 comments on commit fe7aa9b

Please sign in to comment.