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.

36 lines
1.2 KiB

4 years ago
  1. var versions = require('./versions');
  2. var fullVersions = require('./full-versions');
  3. var chromiumVersions = require('./chromium-versions');
  4. var fullChromiumVersions = require('./full-chromium-versions');
  5. var electronToChromium = function (query) {
  6. var number = getQueryString(query);
  7. return number.split('.').length > 2 ? fullVersions[number] : versions[number] || undefined;
  8. };
  9. var chromiumToElectron = function (query) {
  10. var number = getQueryString(query);
  11. return number.split('.').length > 2 ? fullChromiumVersions[number] : chromiumVersions[number] || undefined;
  12. };
  13. var electronToBrowserList = function (query) {
  14. var number = getQueryString(query);
  15. return versions[number] ? "Chrome >= " + versions[number] : undefined;
  16. };
  17. var getQueryString = function (query) {
  18. var number = query;
  19. if (query === 1) { number = "1.0" }
  20. if (typeof query === 'number') { number += ''; }
  21. return number;
  22. };
  23. module.exports = {
  24. versions: versions,
  25. fullVersions: fullVersions,
  26. chromiumVersions: chromiumVersions,
  27. fullChromiumVersions: fullChromiumVersions,
  28. electronToChromium: electronToChromium,
  29. electronToBrowserList: electronToBrowserList,
  30. chromiumToElectron: chromiumToElectron
  31. };