plottable 3.9.0-dev-76-g6a7bb807 → 3.9.0-dev-78-gfb876e95

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,4 +10,4 @@ exports.version = void 0;
10
10
  * real version number during the dist phase for for npm module publishing. Modifying this line should
11
11
  * be accompanied by modifying the "sed-version" task in package.json accordingly.
12
12
  */
13
- exports.version = "3.9.0-dev-76-g6a7bb807";
13
+ exports.version = "3.9.0-dev-78-gfb876e95";
@@ -25,22 +25,22 @@ var scale_1 = require("./scale");
25
25
  var ImplicitSeriesTracker = /** @class */ (function () {
26
26
  function ImplicitSeriesTracker() {
27
27
  this.count = 0;
28
- this.tracker = {};
28
+ this.tracker = new Map();
29
29
  }
30
30
  ImplicitSeriesTracker.prototype.getIndex = function (value) {
31
- if (this.tracker[value] != null) {
32
- return this.tracker[value];
31
+ if (this.tracker.has(value)) {
32
+ return this.tracker.get(value);
33
33
  }
34
34
  else {
35
35
  var idx = this.count;
36
- this.tracker[value] = idx;
36
+ this.tracker.set(value, idx);
37
37
  this.count += 1;
38
38
  return idx;
39
39
  }
40
40
  };
41
41
  ImplicitSeriesTracker.prototype.clear = function () {
42
42
  this.count = 0;
43
- this.tracker = {};
43
+ this.tracker.clear();
44
44
  };
45
45
  return ImplicitSeriesTracker;
46
46
  }());
@@ -129,6 +129,39 @@ function stackedExtent(stackingResult, keyAccessor, filter) {
129
129
  var minStackExtent = Utils.Math.min(extents, 0);
130
130
  return [nativeMath.min(minStackExtent, 0), nativeMath.max(0, maxStackExtent)];
131
131
  }
132
+ /**
133
+ * A lodash `MapCache` backed by a `WeakMap`, so each cached string is
134
+ * released once its key object (such as a `Date`) is garbage collected.
135
+ * Primitive keys are never cached: a `WeakMap` cannot hold them, and
136
+ * `String()` on a primitive costs no more than a cache lookup.
137
+ */
138
+ var WeakKeyCache = /** @class */ (function () {
139
+ function WeakKeyCache() {
140
+ this.map = new WeakMap();
141
+ }
142
+ WeakKeyCache.prototype.get = function (key) {
143
+ return this.isObjectKey(key) ? this.map.get(key) : undefined;
144
+ };
145
+ WeakKeyCache.prototype.has = function (key) {
146
+ return this.isObjectKey(key) && this.map.has(key);
147
+ };
148
+ WeakKeyCache.prototype.set = function (key, value) {
149
+ if (this.isObjectKey(key)) {
150
+ this.map.set(key, value);
151
+ }
152
+ return this;
153
+ };
154
+ WeakKeyCache.prototype.delete = function (key) {
155
+ return this.isObjectKey(key) && this.map.delete(key);
156
+ };
157
+ WeakKeyCache.prototype.clear = function () {
158
+ this.map = new WeakMap();
159
+ };
160
+ WeakKeyCache.prototype.isObjectKey = function (key) {
161
+ return typeof key === "object" && key !== null;
162
+ };
163
+ return WeakKeyCache;
164
+ }());
132
165
  /**
133
166
  * Normalizes a key used for stacking
134
167
  *
@@ -138,3 +171,4 @@ function stackedExtent(stackingResult, keyAccessor, filter) {
138
171
  exports.normalizeKey = (0, memoize_1.default)(function (key) {
139
172
  return String(key);
140
173
  });
174
+ exports.normalizeKey.cache = new WeakKeyCache();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "plottable",
3
3
  "description": "A modular charting library built on D3",
4
- "version": "3.9.0-dev-76-g6a7bb807",
4
+ "version": "3.9.0-dev-78-gfb876e95",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
package/plottable.js CHANGED
@@ -18066,22 +18066,22 @@ var scale_1 = __webpack_require__(18);
18066
18066
  var ImplicitSeriesTracker = /** @class */ (function () {
18067
18067
  function ImplicitSeriesTracker() {
18068
18068
  this.count = 0;
18069
- this.tracker = {};
18069
+ this.tracker = new Map();
18070
18070
  }
18071
18071
  ImplicitSeriesTracker.prototype.getIndex = function (value) {
18072
- if (this.tracker[value] != null) {
18073
- return this.tracker[value];
18072
+ if (this.tracker.has(value)) {
18073
+ return this.tracker.get(value);
18074
18074
  }
18075
18075
  else {
18076
18076
  var idx = this.count;
18077
- this.tracker[value] = idx;
18077
+ this.tracker.set(value, idx);
18078
18078
  this.count += 1;
18079
18079
  return idx;
18080
18080
  }
18081
18081
  };
18082
18082
  ImplicitSeriesTracker.prototype.clear = function () {
18083
18083
  this.count = 0;
18084
- this.tracker = {};
18084
+ this.tracker.clear();
18085
18085
  };
18086
18086
  return ImplicitSeriesTracker;
18087
18087
  }());
@@ -19679,6 +19679,39 @@ function stackedExtent(stackingResult, keyAccessor, filter) {
19679
19679
  var minStackExtent = Utils.Math.min(extents, 0);
19680
19680
  return [nativeMath.min(minStackExtent, 0), nativeMath.max(0, maxStackExtent)];
19681
19681
  }
19682
+ /**
19683
+ * A lodash `MapCache` backed by a `WeakMap`, so each cached string is
19684
+ * released once its key object (such as a `Date`) is garbage collected.
19685
+ * Primitive keys are never cached: a `WeakMap` cannot hold them, and
19686
+ * `String()` on a primitive costs no more than a cache lookup.
19687
+ */
19688
+ var WeakKeyCache = /** @class */ (function () {
19689
+ function WeakKeyCache() {
19690
+ this.map = new WeakMap();
19691
+ }
19692
+ WeakKeyCache.prototype.get = function (key) {
19693
+ return this.isObjectKey(key) ? this.map.get(key) : undefined;
19694
+ };
19695
+ WeakKeyCache.prototype.has = function (key) {
19696
+ return this.isObjectKey(key) && this.map.has(key);
19697
+ };
19698
+ WeakKeyCache.prototype.set = function (key, value) {
19699
+ if (this.isObjectKey(key)) {
19700
+ this.map.set(key, value);
19701
+ }
19702
+ return this;
19703
+ };
19704
+ WeakKeyCache.prototype.delete = function (key) {
19705
+ return this.isObjectKey(key) && this.map.delete(key);
19706
+ };
19707
+ WeakKeyCache.prototype.clear = function () {
19708
+ this.map = new WeakMap();
19709
+ };
19710
+ WeakKeyCache.prototype.isObjectKey = function (key) {
19711
+ return typeof key === "object" && key !== null;
19712
+ };
19713
+ return WeakKeyCache;
19714
+ }());
19682
19715
  /**
19683
19716
  * Normalizes a key used for stacking
19684
19717
  *
@@ -19688,6 +19721,7 @@ function stackedExtent(stackingResult, keyAccessor, filter) {
19688
19721
  exports.normalizeKey = (0, memoize_1.default)(function (key) {
19689
19722
  return String(key);
19690
19723
  });
19724
+ exports.normalizeKey.cache = new WeakKeyCache();
19691
19725
 
19692
19726
 
19693
19727
  /***/ }),