polyfills-db
Advanced tools
Comparing version 1.11.3 to 1.12.0
@@ -59,5 +59,4 @@ | ||
if (version === true) return str += 'if (families.' + name + '.test(family)) return true\n' | ||
if (typeof version === 'number') version = '< ' + version | ||
str += 'if (families.' + name + '.test(family)) ' | ||
+ 'return satisfies(version, ' + JSON.stringify(version) + ')\n' | ||
+ 'return satisfies(version, ' + JSON.stringify('<' + version) + ')\n' | ||
}) | ||
@@ -64,0 +63,0 @@ str += 'return ' + String(browsers.default !== false) |
var fs = require('fs') | ||
var semver = require('semver') | ||
var memo = require('memorizer') | ||
@@ -23,5 +24,6 @@ | ||
this.browsers = options.browsers | ||
if (options.browsers) this.browsers = options.browsers | ||
else if (options.caniuse) this.browsers = Feature.caniuseToBrowsers(options.caniuse) | ||
if (options.filter) this.filter = options.filter | ||
else if (options.browsers) this.filter = agents.compile(options.browsers) | ||
else if (this.browsers) this.filter = agents.compile(this.browsers) | ||
if (options.runtime) this.runtimeFilename = options.runtime | ||
@@ -57,1 +59,41 @@ } | ||
}) | ||
Feature.caniuseToBrowsers = function (feature) { | ||
var json = require('caniuse-db/features-json/' + feature + '.json') | ||
var browsers = {} | ||
Object.keys(caniuseBrowsers).forEach(function (browser) { | ||
var version = lowestOf(json.stats[caniuseBrowsers[browser]]) | ||
if (version) browsers[browser] = version | ||
}) | ||
return browsers | ||
} | ||
var caniuseBrowsers = { | ||
ie: 'ie', | ||
ff: 'firefox', | ||
chrome: 'chrome', | ||
safari: 'safari', | ||
opera: 'opera', | ||
ios: 'ios_saf', | ||
android: 'android', | ||
iep: 'ie_mob', | ||
} | ||
function lowestOf(obj) { | ||
// versions are listed in ascending order | ||
var versions = Object.keys(obj).sort(function (a, b) { | ||
return semver.compare(semverify(a), semverify(b)) | ||
}) | ||
for (var i = 0; i < versions.length; i++) { | ||
var version = versions[i] | ||
if (obj[version] !== 'y') continue | ||
return version.split('-')[0] | ||
} | ||
} | ||
function semverify(x) { | ||
x = x.split('-')[0] | ||
while (!semver.valid(x)) x += '.0' | ||
return x | ||
} |
@@ -93,9 +93,3 @@ [ | ||
], | ||
"browsers": { | ||
"ff": 29, | ||
"chrome": 33, | ||
"ios": 8, | ||
"safari": 7.1, | ||
"opera": 20 | ||
} | ||
"caniuse": "promises" | ||
}, | ||
@@ -125,11 +119,3 @@ { | ||
], | ||
"browsers": { | ||
"chrome": 24, | ||
"ff": 24, | ||
"ie": 10, | ||
"opera": 15, | ||
"safari": 5.1, | ||
"ios": 5.1, | ||
"android": 3 | ||
} | ||
"caniuse": "classlist" | ||
}, | ||
@@ -148,6 +134,3 @@ { | ||
], | ||
"browsers": { | ||
"chrome": 34, | ||
"ff": 34 | ||
} | ||
"caniuse": "matchesselector" | ||
}, | ||
@@ -194,11 +177,3 @@ { | ||
], | ||
"browsers": { | ||
"ie": 10, | ||
"ff": 23, | ||
"chrome": 24, | ||
"ios": 7, | ||
"safari": 6.1, | ||
"android": 4.4, | ||
"opera": 15 | ||
} | ||
"caniuse": "requestanimationframe" | ||
}, | ||
@@ -230,10 +205,3 @@ { | ||
], | ||
"browsers": { | ||
"ff": 6, | ||
"chrome": 6, | ||
"ios": 4, | ||
"safari": 5, | ||
"android": 4.4, | ||
"opera": 11 | ||
} | ||
"caniuse": "eventsource" | ||
}, | ||
@@ -253,7 +221,3 @@ { | ||
], | ||
"browsers": { | ||
"ie": 10, | ||
"ff": 1.7, | ||
"default": false | ||
} | ||
"caniuse": "atob-btoa" | ||
}, | ||
@@ -292,11 +256,3 @@ { | ||
], | ||
"browsers": { | ||
"ie": 10, | ||
"ff": 6, | ||
"chrome": 9, | ||
"ios": 5, | ||
"safari": 5.1, | ||
"android": 3, | ||
"opera": 12.1 | ||
} | ||
"caniuse": "matchmedia" | ||
}, | ||
@@ -510,4 +466,5 @@ { | ||
"https://developer.mozilla.org/en-US/docs/Web/HTML/Element/picture" | ||
] | ||
], | ||
"caniuse": "picture" | ||
} | ||
] |
@@ -9,5 +9,3 @@ [ | ||
], | ||
"browsers": { | ||
"ff": 31 | ||
} | ||
"caniuse": "css-variables" | ||
}, | ||
@@ -40,12 +38,4 @@ { | ||
], | ||
"browsers": { | ||
"ie": 9, | ||
"ff": 19, | ||
"chrome": 27, | ||
"safari": 6, | ||
"opera": 13, | ||
"android": "4.4", | ||
"ios": "6.1.4" | ||
} | ||
"caniuse": "calc" | ||
} | ||
] |
{ | ||
"name": "polyfills-db", | ||
"description": "browser feature database", | ||
"version": "1.11.3", | ||
"version": "1.12.0", | ||
"author": { | ||
@@ -14,2 +14,3 @@ "name": "Jonathan Ong", | ||
"dependencies": { | ||
"caniuse-db": "1", | ||
"flatten": "0", | ||
@@ -49,5 +50,5 @@ "memorizer": "1", | ||
"scripts": { | ||
"test": "mocha --reporter spec --bail", | ||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot", | ||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot" | ||
"test": "mocha --reporter spec --bail --timeout 10s", | ||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --timeout 10s", | ||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot --timeout 10s" | ||
}, | ||
@@ -54,0 +55,0 @@ "keywords": [ |
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
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
27314
5
845
6
+ Addedcaniuse-db@1
+ Addedcaniuse-db@1.0.30001680(transitive)