0.0.1 • Published 8 years ago

express-polyfill-service v0.0.1

Weekly downloads
1
License
MIT
Repository
github
Last release
8 years ago

Express Polyfill Service

An express middleware for Polyfill Service by Financial-Times

Installation

npm install express-polyfill-service --save

Usage

var polyfill = require('express-polyfill-service');

app.use('/polyfill.js', polyfill());
<script type="application/javascript" src="/polyfill.js"></script>

API

app.use('/polyfill.js', polyfill([options]));

options is a javascript object with the following properties:

These are the default properties passed directly to getPolyfillString

  • uaString: String, required. The user agent to evaluate for polyfills that should be included conditionally
  • minify: Boolean, optional. Whether to minify the bundle
  • features: Object, optional. An object with the features that are to be considered for polyfill inclusion. If not supplied, no features will be considered and the output will be blank. To load the default feature set, set features to {default:{}}. Each feature must be an entry in the features object with the key corresponding to the name of the feature and the value an object with the following properties:
    • flags: Array, optional. Array of flags to apply to this feature (see below)
    • unknown: String, optional. What to do when the user agent is not recognised. Set to polyfill to return default polyfill variants of all qualifying features, ignore to return nothing. Defaults to ignore.

Flags that may be applied to polyfills are:

  • gated: Wrap this polyfill in a feature-detect, to avoid overwriting the native implementation
  • always: Include this polyfill regardless of the user-agent