version.js 985 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /**
  2. * DevExtreme (core/utils/version.js)
  3. * Version: 19.1.16
  4. * Build date: Tue Oct 18 2022
  5. *
  6. * Copyright (c) 2012 - 2022 Developer Express Inc. ALL RIGHTS RESERVED
  7. * Read about DevExtreme licensing here: https://js.devexpress.com/Licensing/
  8. */
  9. "use strict";
  10. exports.compare = function(x, y, maxLevel) {
  11. function normalizeArg(value) {
  12. if ("string" === typeof value) {
  13. return value.split(".")
  14. }
  15. if ("number" === typeof value) {
  16. return [value]
  17. }
  18. return value
  19. }
  20. x = normalizeArg(x);
  21. y = normalizeArg(y);
  22. var length = Math.max(x.length, y.length);
  23. if (isFinite(maxLevel)) {
  24. length = Math.min(length, maxLevel)
  25. }
  26. for (var i = 0; i < length; i++) {
  27. var xItem = parseInt(x[i] || 0, 10);
  28. var yItem = parseInt(y[i] || 0, 10);
  29. if (xItem < yItem) {
  30. return -1
  31. }
  32. if (xItem > yItem) {
  33. return 1
  34. }
  35. }
  36. return 0
  37. };