plottable 3.9.0-dev-77-g85e05cc1 → 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-77-g85e05cc1";
13
+ exports.version = "3.9.0-dev-78-gfb876e95";
@@ -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-77-g85e05cc1",
4
+ "version": "3.9.0-dev-78-gfb876e95",
5
5
  "license": "MIT",
6
6
  "repository": {
7
7
  "type": "git",
package/plottable.js CHANGED
@@ -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
  /***/ }),