TreemapUtilities.js 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /* *
  2. *
  3. * (c) 2014-2021 Highsoft AS
  4. *
  5. * Authors: Jon Arild Nygard / Oystein Moseng
  6. *
  7. * License: www.highcharts.com/license
  8. *
  9. * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!!
  10. *
  11. * */
  12. 'use strict';
  13. /* *
  14. *
  15. * Imports
  16. *
  17. * */
  18. import U from '../../Core/Utilities.js';
  19. var objectEach = U.objectEach;
  20. /* *
  21. *
  22. * Namespace
  23. *
  24. * */
  25. var TreemapUtilities;
  26. (function (TreemapUtilities) {
  27. TreemapUtilities.AXIS_MAX = 100;
  28. /* eslint-disable no-invalid-this, valid-jsdoc */
  29. /**
  30. * @todo Similar to eachObject, this function is likely redundant
  31. */
  32. function isBoolean(x) {
  33. return typeof x === 'boolean';
  34. }
  35. TreemapUtilities.isBoolean = isBoolean;
  36. /**
  37. * @todo Similar to recursive, this function is likely redundant
  38. */
  39. function eachObject(list, func, context) {
  40. context = context || this;
  41. objectEach(list, function (val, key) {
  42. func.call(context, val, key, list);
  43. });
  44. }
  45. TreemapUtilities.eachObject = eachObject;
  46. /**
  47. * @todo find correct name for this function.
  48. * @todo Similar to reduce, this function is likely redundant
  49. */
  50. function recursive(item, func, context) {
  51. if (context === void 0) { context = this; }
  52. var next;
  53. next = func.call(context, item);
  54. if (next !== false) {
  55. recursive(next, func, context);
  56. }
  57. }
  58. TreemapUtilities.recursive = recursive;
  59. })(TreemapUtilities || (TreemapUtilities = {}));
  60. /* *
  61. *
  62. * Default Export
  63. *
  64. * */
  65. export default TreemapUtilities;