Skip to content

Commit

Permalink
fix: fallback to transpiled code on Node.js version <8.6.0 (#160)
Browse files Browse the repository at this point in the history
Co-authored-by: lukeed <luke.edwards05@gmail.com>
  • Loading branch information
2 people authored and terkelg committed May 21, 2019
1 parent 91be062 commit e4691d7
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
function isNodeLT(tar) {
tar = (Array.isArray(tar) ? tar : tar.split('.')).map(Number);
let i=0, src=process.versions.node.split('.').map(Number);
for (; i < tar.length; i++) {
if (src[i] > tar[i]) return false;
if (tar[i] > src[i]) return true;
}
return false;
}

module.exports =
parseInt(process.versions.node, 10) < 8
isNodeLT('8.6.0')
? require('./dist/index.js')
: require('./lib/index.js');

0 comments on commit e4691d7

Please sign in to comment.