@graffy/common 0.16.0-alpha.11 → 0.16.0-alpha.13

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.
Files changed (3) hide show
  1. package/index.cjs +6 -1
  2. package/index.mjs +6 -1
  3. package/package.json +2 -2
package/index.cjs CHANGED
@@ -118,6 +118,9 @@ const stringifyDescriptor = {
118
118
  }
119
119
  };
120
120
  function addStringify(buffer) {
121
+ if (Object.hasOwn(buffer, "toJSON") || Object.hasOwn(buffer, "toString") || Object.hasOwn(buffer, Symbol.for("nodejs.util.inspect.custom"))) {
122
+ return buffer;
123
+ }
121
124
  Object.defineProperties(buffer, {
122
125
  toJSON: stringifyDescriptor,
123
126
  toString: stringifyDescriptor,
@@ -282,10 +285,12 @@ function keyStep(key) {
282
285
  switch (key[l]) {
283
286
  case 0:
284
287
  newKey = key.slice(0, l);
288
+ addStringify(newKey);
285
289
  step = 1;
286
290
  break;
287
291
  case 255:
288
292
  newKey = key.slice(0, l);
293
+ addStringify(newKey);
289
294
  newKey[l - 1]++;
290
295
  step = -1;
291
296
  break;
@@ -293,7 +298,7 @@ function keyStep(key) {
293
298
  newKey = key;
294
299
  step = 0;
295
300
  }
296
- return { key: addStringify(newKey), step };
301
+ return { key: newKey, step };
297
302
  }
298
303
  function keyBefore(key) {
299
304
  if (isMinKey(key) || isMaxKey(key))
package/index.mjs CHANGED
@@ -113,6 +113,9 @@ const stringifyDescriptor = {
113
113
  }
114
114
  };
115
115
  function addStringify(buffer) {
116
+ if (Object.hasOwn(buffer, "toJSON") || Object.hasOwn(buffer, "toString") || Object.hasOwn(buffer, Symbol.for("nodejs.util.inspect.custom"))) {
117
+ return buffer;
118
+ }
116
119
  Object.defineProperties(buffer, {
117
120
  toJSON: stringifyDescriptor,
118
121
  toString: stringifyDescriptor,
@@ -277,10 +280,12 @@ function keyStep(key) {
277
280
  switch (key[l]) {
278
281
  case 0:
279
282
  newKey = key.slice(0, l);
283
+ addStringify(newKey);
280
284
  step = 1;
281
285
  break;
282
286
  case 255:
283
287
  newKey = key.slice(0, l);
288
+ addStringify(newKey);
284
289
  newKey[l - 1]++;
285
290
  step = -1;
286
291
  break;
@@ -288,7 +293,7 @@ function keyStep(key) {
288
293
  newKey = key;
289
294
  step = 0;
290
295
  }
291
- return { key: addStringify(newKey), step };
296
+ return { key: newKey, step };
292
297
  }
293
298
  function keyBefore(key) {
294
299
  if (isMinKey(key) || isMaxKey(key))
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graffy/common",
3
3
  "description": "Common libraries that used by various Graffy modules.",
4
4
  "author": "aravind (https://github.com/aravindet)",
5
- "version": "0.16.0-alpha.11",
5
+ "version": "0.16.0-alpha.13",
6
6
  "main": "./index.cjs",
7
7
  "exports": {
8
8
  "import": "./index.mjs",
@@ -18,6 +18,6 @@
18
18
  "dependencies": {
19
19
  "lodash": "^4.17.19",
20
20
  "merge-async-iterators": "^0.2.1",
21
- "@graffy/stream": "0.16.0-alpha.11"
21
+ "@graffy/stream": "0.16.0-alpha.13"
22
22
  }
23
23
  }