[Node.js] Need a package to get the ECMAScript version of a browser? You found it!
## Installation
Run the following command to add the package to your dev dependencies:
$ npm install --save @gnodi/ecma-version
## Use
const ecmaVersion = require('@gnodi/ecma-version');
ecmaVersion.getFromBrowser('Firefox', 10); // Return 5
ecmaVersion.getFromBrowser('Firefox', 55); // Return 6
ecmaVersion.getFromUserAgent(
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/53.0.2785.143 Chrome/53.0.2785.143 Safari/537.36'
);
const http = require('http');
http.createServer((req) => {
const version = ecmaVersion.getFromRequest(req);
console.log(version);
}).listen(3080);
ecmaVersion.getBrowserCompatibleVersion('Firefox', 5); // Return 0
ecmaVersion.getBrowserCompatibleVersion('Firefox', 6); // Return 53
ecmaVersion.getBrowserCompatibleVersion('IE', 6); // Return null