polyfills-db
Advanced tools
Comparing version 0.1.0 to 0.2.0
var agents = require('./agents') | ||
module.exports = Feature | ||
@@ -17,3 +19,3 @@ | ||
if (options.filter) this.filter = options.filter | ||
else if (options.browsers) this.filter = buildFilter(options.browsers) | ||
else if (options.browsers) this.filter = agents.compile(options.browsers) | ||
} | ||
@@ -36,26 +38,4 @@ | ||
// build a filter function from an object of browsers | ||
// order matters! | ||
var families = { | ||
ie: /\bie\b/i, | ||
ff: /\bfirefox\b/i, | ||
chrome: /\bchrome\b/i, | ||
ios: /\bmobile safari\b/i, // needs to be before safari | ||
safari: /\bsafari\b/i, | ||
android: /\bandroid\b/i, | ||
opera: /\bopera\b/i, | ||
ffm: /\bfirefox mobile\b/i, | ||
iep: /\bie phone\b/i, | ||
Feature.prototype.id = function () { | ||
return this.shortName | ||
} | ||
function buildFilter(browsers) { | ||
var str = 'var family = agent.family\n' | ||
Object.keys(families).forEach(function (name) { | ||
if (name in browsers) { | ||
str += 'if (families.' + name + '.test(family)) ' | ||
+ 'return agent.satisfies("< ' + browsers[name] + '")\n' | ||
} | ||
}) | ||
str += 'return ' + String(browsers.default !== false) | ||
return eval('(function filter(agent) {\n' + str + '\n})') | ||
} |
exports.agents = require('./agents') | ||
exports.recast = require('./recast') | ||
exports.postcss = require('./postcss') | ||
exports.polyfills = require('./polyfills') |
{ | ||
"name": "polyfills-db", | ||
"description": "browser feature database", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"author": { | ||
@@ -13,6 +13,8 @@ "name": "Jonathan Ong", | ||
"repository": "polyfills/db", | ||
"dependencies": {}, | ||
"devDependencies": { | ||
"dependencies": { | ||
"semver": "3", | ||
"useragent": "2", | ||
"flatten": "0" | ||
}, | ||
"devDependencies": { | ||
"mocha": "1", | ||
@@ -22,3 +24,3 @@ "istanbul": "0" | ||
"scripts": { | ||
"test": "mocha --reporter spec", | ||
"test": "mocha --reporter spec --bail", | ||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot", | ||
@@ -35,3 +37,5 @@ "test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot" | ||
"main": "lib", | ||
"files": "lib" | ||
"files": [ | ||
"lib" | ||
] | ||
} |
@@ -20,4 +20,4 @@ | ||
[npm-image]: https://img.shields.io/npm/v/db.svg?style=flat | ||
[npm-url]: https://npmjs.org/package/db | ||
[npm-image]: https://img.shields.io/npm/v/polyfills-db.svg?style=flat | ||
[npm-url]: https://npmjs.org/package/polyfills-db | ||
[travis-image]: https://img.shields.io/travis/polyfills/db.svg?style=flat | ||
@@ -24,0 +24,0 @@ [travis-url]: https://travis-ci.org/polyfills/db |
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
2
14907
3
8
441
+ Addedflatten@0
+ Addedsemver@3
+ Addeduseragent@2
+ Addedflatten@0.0.1(transitive)
+ Addedlru-cache@4.1.5(transitive)
+ Addedos-tmpdir@1.0.2(transitive)
+ Addedpseudomap@1.0.2(transitive)
+ Addedsemver@3.0.1(transitive)
+ Addedtmp@0.0.33(transitive)
+ Addeduseragent@2.3.0(transitive)
+ Addedyallist@2.1.2(transitive)