Polyfiller
A polyfill combinator
Getting Started
This package requires Node ~0.10.0
If you haven't used npm before, be sure to check out the Getting Started guide, as it explains how to install npm and use a package.json file. Once you're familiar with that process, you may install this package with this command:
npm install polyfiller --save-dev
Once the package has been installed, it may be used inside your files with this line of JavaScript:
var Polyfiller = ;
Usage Example
var fs = ; var polyfiller = ;var list = polyfiller; fs;
Catalog
A list of available features
Compatibility
Theoretically compatible with all contemporary browsers since IE9.
For IE8 only it's recommended to include ie8 script before your build
Methods
find
Type: Function (Array, [ Function (feature, name, features) ])
Returns: Array
Returns an unordered bundle of polyfills as an array of objects
var polyfiller = ; var list = polyfiller; list0source; // source codelist0configname; // Promise
Also available the second format (it may be useful in the future versions):
var polyfiller = ; var list = polyfiller;
list
Type: Function ([extended=false])
Returns: Array
Returns a list of all available features as an array of strings.
var polyfiller = ; polyfiller; // ['Promise', 'Reflect', 'URL', ...]
extended option
var polyfiller = ;var list = polyfiller; list; // [{ config }, ...]list0name; // Array.fromlist0author; // Mathias Bynenslist0licenses0type; // MIT...
For more information see the config format
pack
Type: Function (features)
Returns: String
Packs a list of polyfills into one string
var polyfiller = ; var list = polyfiller code = polyfiller;
Options
exclude
Type: Array
Default: []
Some polyfills have dependencies that you can exclude here
var polyfiller = exclude: 'setImmediate';
verbose
Type: Boolean
Default: false
Verbose mode is an option that provides additional details as to what the package is doing.
var polyfiller = verbose: true;
wrapper
Type: Function
Default (find
): None
Default (pack
): see
A custom wrapper for your environment.
var polyfiller = { return ';(function () {' + source + '}.call(self));' };
Also this option is available like a method:
var polyfiller = ; polyfilleroptions;
modules
Do you want to use some specific npm
or bower
modules?
var path = ; var polyfiller = modules: path path ;
NOTE: Please use only with the option catalog
.
catalog
Type: Array
Default: [trunk/catalog]
Have custom polyfills? Add paths to their location here.
var path = ; var polyfiller = catalog: path ;
If you want to use npm
or bower
packages in your catalog, please see modules
section.
Required file structure for each new package:
catalog
Promise
index.json
index.js
index.json
There are dependencies?
"dependencies": ["window.setImmediate"]
index.js
moduleexports = type: 'npm' name: 'es6-promises' ;
type
Type: string [npm | bower | file]
Default: None
name
Type: string
Default: None
The files are located locally?
catalog
Promise
files
index.js — your polyfill
index.json
index.js
// index.js var path = ; moduleexports = type: 'file' name: path ;
Tests
npm test
Contributing
Please see our contributing guide
Have an interesting and well-tested polyfill?
License
MIT
Task submitted by Alexander Abashkin