diff options
Diffstat (limited to 'node_modules/caniuse-lite/dist/unpacker')
7 files changed, 201 insertions, 0 deletions
diff --git a/node_modules/caniuse-lite/dist/unpacker/agents.js b/node_modules/caniuse-lite/dist/unpacker/agents.js new file mode 100644 index 0000000..8dc5d49 --- /dev/null +++ b/node_modules/caniuse-lite/dist/unpacker/agents.js @@ -0,0 +1,51 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.agents = undefined; + +var _browsers = require('./browsers'); + +var _browserVersions = require('./browserVersions'); + +var agentsData = require('../../data/agents'); + +function unpackBrowserVersions(versionsData) { + return Object.keys(versionsData).reduce(function (usage, version) { + usage[_browserVersions.browserVersions[version]] = versionsData[version]; + return usage; + }, {}); +} + +var agents = exports.agents = Object.keys(agentsData).reduce(function (map, key) { + var versionsData = agentsData[key]; + map[_browsers.browsers[key]] = Object.keys(versionsData).reduce(function (data, entry) { + if (entry === 'A') { + data.usage_global = unpackBrowserVersions(versionsData[entry]); + } else if (entry === 'C') { + data.versions = versionsData[entry].reduce(function (list, version) { + if (version === '') { + list.push(null); + } else { + list.push(_browserVersions.browserVersions[version]); + } + return list; + }, []); + } else if (entry === 'D') { + data.prefix_exceptions = unpackBrowserVersions(versionsData[entry]); + } else if (entry === 'E') { + data.browser = versionsData[entry]; + } else if (entry === 'F') { + data.release_date = Object.keys(versionsData[entry]).reduce(function (map, key) { + map[_browserVersions.browserVersions[key]] = versionsData[entry][key]; + return map; + }, {}); + } else { + // entry is B + data.prefix = versionsData[entry]; + } + return data; + }, {}); + return map; +}, {});
\ No newline at end of file diff --git a/node_modules/caniuse-lite/dist/unpacker/browserVersions.js b/node_modules/caniuse-lite/dist/unpacker/browserVersions.js new file mode 100644 index 0000000..f63d752 --- /dev/null +++ b/node_modules/caniuse-lite/dist/unpacker/browserVersions.js @@ -0,0 +1,6 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var browserVersions = exports.browserVersions = require('../../data/browserVersions');
\ No newline at end of file diff --git a/node_modules/caniuse-lite/dist/unpacker/browsers.js b/node_modules/caniuse-lite/dist/unpacker/browsers.js new file mode 100644 index 0000000..4ef0082 --- /dev/null +++ b/node_modules/caniuse-lite/dist/unpacker/browsers.js @@ -0,0 +1,6 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +var browsers = exports.browsers = require('../../data/browsers');
\ No newline at end of file diff --git a/node_modules/caniuse-lite/dist/unpacker/feature.js b/node_modules/caniuse-lite/dist/unpacker/feature.js new file mode 100644 index 0000000..d484a57 --- /dev/null +++ b/node_modules/caniuse-lite/dist/unpacker/feature.js @@ -0,0 +1,58 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = unpackFeature; + +var _statuses = require('../lib/statuses'); + +var _statuses2 = _interopRequireDefault(_statuses); + +var _supported = require('../lib/supported'); + +var _supported2 = _interopRequireDefault(_supported); + +var _browsers = require('./browsers'); + +var _browserVersions = require('./browserVersions'); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var MATH2LOG = Math.log(2); + +function unpackSupport(cipher) { + // bit flags + var stats = Object.keys(_supported2.default).reduce(function (list, support) { + if (cipher & _supported2.default[support]) list.push(support); + return list; + }, []); + + // notes + var notes = cipher >> 7; + var notesArray = []; + while (notes) { + var note = Math.floor(Math.log(notes) / MATH2LOG) + 1; + notesArray.unshift('#' + note); + notes -= Math.pow(2, note - 1); + } + + return stats.concat(notesArray).join(' '); +} + +function unpackFeature(packed) { + var unpacked = { status: _statuses2.default[packed.B], title: packed.C }; + unpacked.stats = Object.keys(packed.A).reduce(function (browserStats, key) { + var browser = packed.A[key]; + browserStats[_browsers.browsers[key]] = Object.keys(browser).reduce(function (stats, support) { + var packedVersions = browser[support].split(' '); + var unpacked = unpackSupport(support); + packedVersions.forEach(function (v) { + return stats[_browserVersions.browserVersions[v]] = unpacked; + }); + return stats; + }, {}); + return browserStats; + }, {}); + return unpacked; +}
\ No newline at end of file diff --git a/node_modules/caniuse-lite/dist/unpacker/features.js b/node_modules/caniuse-lite/dist/unpacker/features.js new file mode 100644 index 0000000..dec36e3 --- /dev/null +++ b/node_modules/caniuse-lite/dist/unpacker/features.js @@ -0,0 +1,11 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +/* + * Load this dynamically so that it + * doesn't appear in the rollup bundle. + */ + +var features = exports.features = require('../../data/features');
\ No newline at end of file diff --git a/node_modules/caniuse-lite/dist/unpacker/index.js b/node_modules/caniuse-lite/dist/unpacker/index.js new file mode 100644 index 0000000..2cc2f05 --- /dev/null +++ b/node_modules/caniuse-lite/dist/unpacker/index.js @@ -0,0 +1,43 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); + +var _agents = require('./agents'); + +Object.defineProperty(exports, 'agents', { + enumerable: true, + get: function get() { + return _agents.agents; + } +}); + +var _feature = require('./feature'); + +Object.defineProperty(exports, 'feature', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_feature).default; + } +}); + +var _features = require('./features'); + +Object.defineProperty(exports, 'features', { + enumerable: true, + get: function get() { + return _features.features; + } +}); + +var _region = require('./region'); + +Object.defineProperty(exports, 'region', { + enumerable: true, + get: function get() { + return _interopRequireDefault(_region).default; + } +}); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
\ No newline at end of file diff --git a/node_modules/caniuse-lite/dist/unpacker/region.js b/node_modules/caniuse-lite/dist/unpacker/region.js new file mode 100644 index 0000000..e09ae36 --- /dev/null +++ b/node_modules/caniuse-lite/dist/unpacker/region.js @@ -0,0 +1,26 @@ +'use strict'; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.default = unpackRegion; + +var _browsers = require('./browsers'); + +function unpackRegion(packed) { + return Object.keys(packed).reduce(function (list, browser) { + var data = packed[browser]; + list[_browsers.browsers[browser]] = Object.keys(data).reduce(function (memo, key) { + var stats = data[key]; + if (key === '_') { + stats.split(' ').forEach(function (version) { + return memo[version] = null; + }); + } else { + memo[key] = stats; + } + return memo; + }, {}); + return list; + }, {}); +}
\ No newline at end of file |