Giter VIP home page Giter VIP logo

ecma-version's Introduction

@gnodi/ecma-version

[Node.js] Need a package to get the ECMAScript version of a browser? You found it!

Build Coverage Status Version Downloads Dependencies Dev Dependencies

## 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');

Get the ECMAScript version from a browser name and version

ecmaVersion.getFromBrowser('Firefox', 10); // Return 5
ecmaVersion.getFromBrowser('Firefox', 55); // Return 6

Get the ECMAScript version from a user agent

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'
);

Get the ECMAScript version from a HTTP request object

const http = require('http');

http.createServer((req) => {
  const version = ecmaVersion.getFromRequest(req);

  console.log(version);
}).listen(3080);

Get the browser compatible version for an ECMAScript version

ecmaVersion.getBrowserCompatibleVersion('Firefox', 5); // Return 0
ecmaVersion.getBrowserCompatibleVersion('Firefox', 6); // Return 53
ecmaVersion.getBrowserCompatibleVersion('IE', 6); // Return null

LICENSE

MIT

ecma-version's People

Contributors

gnucki avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.