autopolyfiller
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -6,8 +6,8 @@ var foldExpression = require('../../polyfill-expression-fold'); | ||
var constructors = { | ||
'WeakMap': 'WeakMap', | ||
'Symbol': 'Symbol', | ||
'Set': 'Set', | ||
'Proxy': 'Proxy', | ||
'Promise': 'Promise', | ||
'Map': 'Map' | ||
// 'WeakMap': 'WeakMap', | ||
// 'Symbol': 'Symbol', | ||
// 'Set': 'Set', | ||
// 'Proxy': 'Proxy', | ||
// 'Map': 'Map', | ||
'Promise': 'Promise' | ||
}; | ||
@@ -14,0 +14,0 @@ |
@@ -6,7 +6,7 @@ var foldExpression = require('../../polyfill-expression-fold'); | ||
var globalFunctions = { | ||
// 'requestAnimationFrame': 'Window.prototype.requestAnimationFrame', | ||
// 'cancelAnimationFrame': 'Window.prototype.requestAnimationFrame', | ||
'btoa': 'Window.prototype.base64', | ||
'atob': 'Window.prototype.base64', | ||
'matchMedia': 'Window.prototype.matchMedia', | ||
'requestAnimationFrame': 'Window.prototype.requestAnimationFrame', | ||
'cancelAnimationFrame': 'Window.prototype.requestAnimationFrame' | ||
'matchMedia': 'Window.prototype.matchMedia' | ||
}; | ||
@@ -13,0 +13,0 @@ |
@@ -8,6 +8,6 @@ var foldExpression = require('../../polyfill-expression-fold'); | ||
'every': 'Array.prototype.every', | ||
'fill': 'Array.prototype.fill', | ||
// 'fill': 'Array.prototype.fill', | ||
'filter': 'Array.prototype.filter', | ||
'find': 'Array.prototype.find', | ||
'findIndex': 'Array.prototype.findIndex', | ||
// 'find': 'Array.prototype.find', | ||
// 'findIndex': 'Array.prototype.findIndex', | ||
'forEach': 'Array.prototype.forEach', | ||
@@ -28,11 +28,11 @@ 'indexOf': 'Array.prototype.indexOf', | ||
// Number | ||
'clz': 'Number.prototype.clz', | ||
// 'clz': 'Number.prototype.clz', | ||
// String | ||
'codePointAt': 'String.prototype.codePointAt', | ||
'contains': 'String.prototype.contains', | ||
'endsWith': 'String.prototype.endsWith', | ||
'repeat': 'String.prototype.repeat', | ||
'startsWith': 'String.prototype.startsWith', | ||
'toArray': 'String.prototype.toArray', | ||
// 'codePointAt': 'String.prototype.codePointAt', | ||
// 'contains': 'String.prototype.contains', | ||
// 'endsWith': 'String.prototype.endsWith', | ||
// 'repeat': 'String.prototype.repeat', | ||
// 'startsWith': 'String.prototype.startsWith', | ||
// 'toArray': 'String.prototype.toArray', | ||
'trim': 'String.prototype.trim' | ||
@@ -39,0 +39,0 @@ }; |
@@ -7,5 +7,5 @@ var foldExpression = require('../../polyfill-expression-fold'); | ||
'Array': { | ||
'from': 'Array.from', | ||
'isArray': 'Array.isArray', | ||
'of': 'Array.of' | ||
//'from': 'Array.from', | ||
'of': 'Array.of', | ||
'isArray': 'Array.isArray' | ||
}, | ||
@@ -19,46 +19,46 @@ 'Date': { | ||
}, | ||
'Math': { | ||
'acosh': 'Math.acosh', | ||
'asinh': 'Math.asinh', | ||
'atanh': 'Math.atanh', | ||
'cosh': 'Math.cosh', | ||
'expm1': 'Math.expm1', | ||
'fround': 'Math.fround', | ||
'hypot': 'Math.hypot', | ||
'imul': 'Math.imul', | ||
'log10': 'Math.log10', | ||
'log1p': 'Math.log1p', | ||
'log2': 'Math.log2', | ||
'sign': 'Math.sign', | ||
'sinh': 'Math.sinh', | ||
'tanh': 'Math.tanh', | ||
'trunc': 'Math.trunc' | ||
}, | ||
'Number': { | ||
'isFinite': 'Number.isFinite', | ||
'isInteger': 'Number.isInteger', | ||
'isNaN': 'Number.isNaN', | ||
'toInteger': 'Number.toInteger' | ||
}, | ||
// 'Math': { | ||
// 'acosh': 'Math.acosh', | ||
// 'asinh': 'Math.asinh', | ||
// 'atanh': 'Math.atanh', | ||
// 'cosh': 'Math.cosh', | ||
// 'expm1': 'Math.expm1', | ||
// 'fround': 'Math.fround', | ||
// 'hypot': 'Math.hypot', | ||
// 'imul': 'Math.imul', | ||
// 'log10': 'Math.log10', | ||
// 'log1p': 'Math.log1p', | ||
// 'log2': 'Math.log2', | ||
// 'sign': 'Math.sign', | ||
// 'sinh': 'Math.sinh', | ||
// 'tanh': 'Math.tanh', | ||
// 'trunc': 'Math.trunc' | ||
// }, | ||
// 'Number': { | ||
// 'isFinite': 'Number.isFinite', | ||
// 'isInteger': 'Number.isInteger', | ||
// 'isNaN': 'Number.isNaN', | ||
// 'toInteger': 'Number.toInteger' | ||
// }, | ||
'Object': { | ||
'assign': 'Object.assign', | ||
// 'assign': 'Object.assign', | ||
'create': 'Object.create', | ||
'defineProperties': 'Object.defineProperties', | ||
'defineProperty': 'Object.defineProperty', | ||
'freeze': 'Object.freeze', | ||
'getOwnPropertyDescriptor': 'Object.getOwnPropertyDescriptor', | ||
'getOwnPropertyDescriptors': 'Object.getOwnPropertyDescriptors', | ||
// 'freeze': 'Object.freeze', | ||
// 'getOwnPropertyDescriptor': 'Object.getOwnPropertyDescriptor', | ||
// 'getOwnPropertyDescriptors': 'Object.getOwnPropertyDescriptors', | ||
'getOwnPropertyNames': 'Object.getOwnPropertyNames', | ||
'getPropertyDescriptor': 'Object.getPropertyDescriptor', | ||
'getPropertyNames': 'Object.getPropertyNames', | ||
// 'getPropertyDescriptor': 'Object.getPropertyDescriptor', | ||
// 'getPropertyNames': 'Object.getPropertyNames', | ||
'getPrototypeOf': 'Object.getPrototypeOf', | ||
'is': 'Object.is', | ||
'isExtensible': 'Object.isExtensible', | ||
'isFrozen': 'Object.isFrozen', | ||
'isSealed': 'Object.isSealed', | ||
'keys': 'Object.keys', | ||
'observe': 'Object.observe', | ||
'preventExtensions': 'Object.preventExtensions', | ||
'seal': 'Object.seal', | ||
'setPrototypeOf': 'Object.setPrototypeOf' | ||
// 'isExtensible': 'Object.isExtensible', | ||
// 'isFrozen': 'Object.isFrozen', | ||
// 'isSealed': 'Object.isSealed', | ||
// 'observe': 'Object.observe', | ||
// 'preventExtensions': 'Object.preventExtensions', | ||
// 'seal': 'Object.seal', | ||
// 'setPrototypeOf': 'Object.setPrototypeOf', | ||
'keys': 'Object.keys' | ||
} | ||
@@ -65,0 +65,0 @@ }; |
@@ -5,3 +5,3 @@ { | ||
"keywords": ["polyfill", "polyfills", "dom", "ecmascript", "ecmascript5", "ecmascript6", "postprocessor"], | ||
"version" : "1.1.0", | ||
"version" : "1.1.1", | ||
"author" : "Mikhail Davydov <i@azproduction.ru>", | ||
@@ -8,0 +8,0 @@ "contributors" : [ |
@@ -5,10 +5,17 @@ # Autopolyfiller — Precise polyfills | ||
This is like [Autoprefixer](https://github.com/ai/autoprefixer), but for JavaScript polyfills | ||
This is like [Autoprefixer](https://github.com/ai/autoprefixer), but for JavaScript polyfills. It scans your code and applies only required polyfills. | ||
How it works: | ||
Assume you code is `Object.keys(window)`. `Object.keys` polyfill is required to run it [in any browser](http://kangax.github.io/es5-compat-table/#Object.keys) (include IE7). On the other hand this code can be executed on iOS 7 Safari without any polyfills. AutoPolyfiller knows about ES5 and ES6 features and their support in browsers. It can help you to write cutting-edge JavaScript without thinking about ES shims and shivs. | ||
* Using AST matchers it scans your code and finds all polyfills | ||
* If target browsers are specified, then it reduces the list of polyfills according to the "feature database" | ||
* It generates polyfills code which precisely fixes only required features | ||
How it works. Step by step: | ||
1. Using AST matchers it scans your code and finds all polyfills | ||
2. If target browsers are specified, then it reduces the list of polyfills according to the "feature database" | ||
3. It generates polyfills code, using [polyfills database](https://github.com/jonathantneal/polyfill), which precisely fixes only required features | ||
Limitations: | ||
* Right now it supports only safe and cross-browser [polyfiis from ES5](https://github.com/jonathantneal/polyfill), but you can add your own (see examples). | ||
* It can have a false-positives for some cases. For instance, autopolyfiller thinks that `$('div').map()` is call of `Array.prototype.map`. But you can exclude false-positives (see examples). | ||
It will not work if: | ||
@@ -34,6 +41,7 @@ | ||
## Grunt & Gulp tasks | ||
## Grunt, Gulp & Enb tasks | ||
* [grunt-autopolyfiller](https://github.com/azproduction/grunt-autopolyfiller/) - Grunt task for autopolyfiller. | ||
* [gulp-autopolyfiller](https://github.com/azproduction/gulp-autopolyfiller/) - Gulp task for autopolyfiller. | ||
* [enb-autopolyfiller](https://github.com/enb-make/enb-autopolyfiller/) - Enb task for autopolyfiller. | ||
@@ -40,0 +48,0 @@ ## Example |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
134
521771