You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
550 B

3 months ago
  1. 'use strict'
  2. const browsers = require('./browsers').browsers
  3. function unpackRegion(packed) {
  4. return Object.keys(packed).reduce((list, browser) => {
  5. let data = packed[browser]
  6. list[browsers[browser]] = Object.keys(data).reduce((memo, key) => {
  7. let stats = data[key]
  8. if (key === '_') {
  9. stats.split(' ').forEach(version => (memo[version] = null))
  10. } else {
  11. memo[key] = stats
  12. }
  13. return memo
  14. }, {})
  15. return list
  16. }, {})
  17. }
  18. module.exports = unpackRegion
  19. module.exports.default = unpackRegion