Add 'use strict' to module
daecabhir opened this issue · 4 comments
We're currently running under Node.js 4.x, and attempting to use promisepipe results in the following error:
SyntaxError : Block-scoped declarations (let, const, function, class) not yet supported outside strict mode.
Too much ES6 syntax for node 4 :( https://travis-ci.org/epeli/node-promisepipe/jobs/213022236
@epeli there are only 2 instances of syntax in use that are not compatible with node 4: destructuring and the rest operator. I'd like to use this helpful module in my (still) node 4 project. The fixes (in conjunction with the addition of 'use strict';
) are trivial:
To replace const { message = err } = err || {};
in b2287d05b6 index.js:6:
const message = err && err.message || err;
To replace function promisePipe(...streams) {
in b2287d05b6 index.js:31:
/**
* @param {...Stream} stream
*/
function promisePipe(stream) {
let i = arguments.length;
const streams = [];
while ( i-- ) streams[i] = arguments[i];
// ...
I would be happy to provide a PR.
Sorry for the additional commit dupes, screwed up the commit meta and had to amend + force push. Hopefully they get cleaned up via GC at some point...
Anyways, PR ready.