Skip to content

Instantly share code, notes, and snippets.

@kripod
Created April 26, 2016 19:17
Show Gist options
  • Save kripod/5aeb53358858714ceffce39c335f81ad to your computer and use it in GitHub Desktop.
Save kripod/5aeb53358858714ceffce39c335f81ad to your computer and use it in GitHub Desktop.
Node.js - ES6 directory selector
var nodeVersion = parseInt(process.versions.node.split('.')[0]);
if (nodeVersion >= 6) {
// Use the untranspiled ES6 code
require('./src');
} else {
// Use the transpiled ES5 code
require('./lib');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment