index.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  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. };