Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
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.

agents.js 1.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. const { browsers } = require('./browsers')
  2. const versions = require('./browserVersions').browserVersions
  3. const agentsData = require('../../data/agents')
  4. function unpackBrowserVersions(versionsData) {
  5. return Object.keys(versionsData).reduce((usage, version) => {
  6. usage[versions[version]] = versionsData[version]
  7. return usage
  8. }, {})
  9. }
  10. module.exports.agents = Object.keys(agentsData).reduce((map, key) => {
  11. let versionsData = agentsData[key]
  12. map[browsers[key]] = Object.keys(versionsData).reduce((data, entry) => {
  13. if (entry === 'A') {
  14. data.usage_global = unpackBrowserVersions(versionsData[entry])
  15. } else if (entry === 'C') {
  16. data.versions = versionsData[entry].reduce((list, version) => {
  17. if (version === '') {
  18. list.push(null)
  19. } else {
  20. list.push(versions[version])
  21. }
  22. return list
  23. }, [])
  24. } else if (entry === 'D') {
  25. data.prefix_exceptions = unpackBrowserVersions(versionsData[entry])
  26. } else if (entry === 'E') {
  27. data.browser = versionsData[entry]
  28. } else if (entry === 'F') {
  29. data.release_date = Object.keys(versionsData[entry]).reduce(
  30. (map2, key2) => {
  31. map2[versions[key2]] = versionsData[entry][key2]
  32. return map2
  33. },
  34. {}
  35. )
  36. } else {
  37. // entry is B
  38. data.prefix = versionsData[entry]
  39. }
  40. return data
  41. }, {})
  42. return map
  43. }, {})