Giter Site home page Giter Site logo

Polyfills

NPM version Build status Test coverage Dependency Status License Downloads Gittip

Create polyfill builds based on the client's browser and serve only what's needed. This allows you to write modern JavaScript without worrying too much (you should still do due diligence) about browser support as well as not penalizing modern browsers with unnecessary polyfills. See https://polyfills.github.io for more details.

Description

This library is merely the "logic" and does not handle any HTTP serving. It essentially does the following:

  • Parses user agent strings for <family> <major>.<minor>.<version> and creates polyfill bundles based on these variables.
  • Returned a bundle of all the minified polyfills.

Installation

npm install polyfills

Usage

var polyfills = require('polyfills')
var polyfill = polyfills(options)
var js = polyfill(<useragent>)

polyfills.load.then( => )

The first .update() instance. Wait until the polyfills are loaded before using this library.

polyfills.update().then( => )

Reload all the polyfills from the source.

var polyfill = polyfills([options])

The options are:

  • include - which polyfills to include. This is an inclusive list. The names are included in polyfills/db.
  • exclude - conversely, you can exclude specific polyfills.

var js = polyfill(useragent)

Bundle a polyfill for a useragent.

app.use(function (req, res, next) {
  var js = polyfill(req.headers['user-agent')
  res.type('js')
  res.send(js)
})

Adding polyfills

Checkout polyfills/db.

polyfills's Projects

db icon db

browser feature database

ecstacy icon ecstacy

JS/CSS/HTML/etc transpiling, minification, and compression middleware

es7-async-fn icon es7-async-fn

Transformer that converts async functions and await expressions into ECMAScript 6 generator functions and yield expressions

koa icon koa

Koa middleware for polyfills

polyfills icon polyfills

Bundle polyfills based on a User-Agent header

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.