Skip to content

Instantly share code, notes, and snippets.

@19h
Last active August 29, 2015 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 19h/3f0943493e38857d9cfc to your computer and use it in GitHub Desktop.
Save 19h/3f0943493e38857d9cfc to your computer and use it in GitHub Desktop.
Javascript Harmony (ES6) detection and >=0.11 Node.js requirement.
try {
(new Map).set();
require("assert").ok((process.version.split(".")[1]|0) > 10);
} catch (e) {
console.log("\nSupport for ES5 environments was dropped.\nES6 is required; Please upgrade to >= 0.11 and run node with --harmony.\n\nYou are currently using " + process.version + ".\n\n"), process.reallyExit()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment