@graffy/common 0.16.10-alpha.1 → 0.16.10-alpha.2
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.
- package/index.cjs +0 -36
- package/index.mjs +0 -36
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -107,40 +107,9 @@ function find(items, compare2, first = 0, last = items.length) {
|
|
|
107
107
|
}
|
|
108
108
|
return currentFirst;
|
|
109
109
|
}
|
|
110
|
-
const stringifyDescriptor = {
|
|
111
|
-
value: function() {
|
|
112
|
-
var _a;
|
|
113
|
-
if ((this == null ? void 0 : this.length) === 0)
|
|
114
|
-
return "·";
|
|
115
|
-
let str = "";
|
|
116
|
-
let bull = false;
|
|
117
|
-
(_a = this == null ? void 0 : this.forEach) == null ? void 0 : _a.call(this, (value, i) => {
|
|
118
|
-
if (value >= 32 && value <= 126) {
|
|
119
|
-
str += String.fromCharCode(value);
|
|
120
|
-
bull = true;
|
|
121
|
-
} else {
|
|
122
|
-
str += (bull ? "·" : "") + `0${value.toString(16)}`.slice(-2) + (i < this.length - 1 ? "·" : "");
|
|
123
|
-
bull = false;
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
return str;
|
|
127
|
-
}
|
|
128
|
-
};
|
|
129
110
|
function addStringify(buffer) {
|
|
130
|
-
if (process.env.NODE_ENV !== "TESTING")
|
|
131
|
-
return buffer;
|
|
132
|
-
if ("toJSON" in buffer || Symbol.for("nodejs.util.inspect.custom") in buffer) {
|
|
133
|
-
return buffer;
|
|
134
|
-
}
|
|
135
|
-
Object.defineProperties(buffer, {
|
|
136
|
-
toJSON: stringifyDescriptor,
|
|
137
|
-
toString: stringifyDescriptor,
|
|
138
|
-
[Symbol.for("nodejs.util.inspect.custom")]: stringifyDescriptor
|
|
139
|
-
});
|
|
140
111
|
return buffer;
|
|
141
112
|
}
|
|
142
|
-
addStringify(MIN_KEY);
|
|
143
|
-
addStringify(MAX_KEY);
|
|
144
113
|
const END = 0;
|
|
145
114
|
const NULL = 1;
|
|
146
115
|
const FALSE = 2;
|
|
@@ -213,7 +182,6 @@ function encode$4(value) {
|
|
|
213
182
|
i += part.length;
|
|
214
183
|
}
|
|
215
184
|
}
|
|
216
|
-
addStringify(buffer);
|
|
217
185
|
return buffer;
|
|
218
186
|
}
|
|
219
187
|
const nextKey = /* @__PURE__ */ new WeakMap();
|
|
@@ -296,12 +264,10 @@ function keyStep(key) {
|
|
|
296
264
|
switch (key[l]) {
|
|
297
265
|
case 0:
|
|
298
266
|
newKey = key.slice(0, l);
|
|
299
|
-
addStringify(newKey);
|
|
300
267
|
step = 1;
|
|
301
268
|
break;
|
|
302
269
|
case 255:
|
|
303
270
|
newKey = key.slice(0, l);
|
|
304
|
-
addStringify(newKey);
|
|
305
271
|
newKey[l - 1]++;
|
|
306
272
|
step = -1;
|
|
307
273
|
break;
|
|
@@ -324,7 +290,6 @@ function keyBefore(key) {
|
|
|
324
290
|
newKey[l]--;
|
|
325
291
|
newKey[l + 1] = 255;
|
|
326
292
|
}
|
|
327
|
-
addStringify(newKey);
|
|
328
293
|
return newKey;
|
|
329
294
|
}
|
|
330
295
|
function keyAfter(key) {
|
|
@@ -340,7 +305,6 @@ function keyAfter(key) {
|
|
|
340
305
|
newKey.set(key, 0);
|
|
341
306
|
newKey[l + 1] = 0;
|
|
342
307
|
}
|
|
343
|
-
addStringify(newKey);
|
|
344
308
|
return newKey;
|
|
345
309
|
}
|
|
346
310
|
function decodeBound(bound) {
|
package/index.mjs
CHANGED
|
@@ -105,40 +105,9 @@ function find(items, compare2, first = 0, last = items.length) {
|
|
|
105
105
|
}
|
|
106
106
|
return currentFirst;
|
|
107
107
|
}
|
|
108
|
-
const stringifyDescriptor = {
|
|
109
|
-
value: function() {
|
|
110
|
-
var _a;
|
|
111
|
-
if ((this == null ? void 0 : this.length) === 0)
|
|
112
|
-
return "·";
|
|
113
|
-
let str = "";
|
|
114
|
-
let bull = false;
|
|
115
|
-
(_a = this == null ? void 0 : this.forEach) == null ? void 0 : _a.call(this, (value, i) => {
|
|
116
|
-
if (value >= 32 && value <= 126) {
|
|
117
|
-
str += String.fromCharCode(value);
|
|
118
|
-
bull = true;
|
|
119
|
-
} else {
|
|
120
|
-
str += (bull ? "·" : "") + `0${value.toString(16)}`.slice(-2) + (i < this.length - 1 ? "·" : "");
|
|
121
|
-
bull = false;
|
|
122
|
-
}
|
|
123
|
-
});
|
|
124
|
-
return str;
|
|
125
|
-
}
|
|
126
|
-
};
|
|
127
108
|
function addStringify(buffer) {
|
|
128
|
-
if (process.env.NODE_ENV !== "TESTING")
|
|
129
|
-
return buffer;
|
|
130
|
-
if ("toJSON" in buffer || Symbol.for("nodejs.util.inspect.custom") in buffer) {
|
|
131
|
-
return buffer;
|
|
132
|
-
}
|
|
133
|
-
Object.defineProperties(buffer, {
|
|
134
|
-
toJSON: stringifyDescriptor,
|
|
135
|
-
toString: stringifyDescriptor,
|
|
136
|
-
[Symbol.for("nodejs.util.inspect.custom")]: stringifyDescriptor
|
|
137
|
-
});
|
|
138
109
|
return buffer;
|
|
139
110
|
}
|
|
140
|
-
addStringify(MIN_KEY);
|
|
141
|
-
addStringify(MAX_KEY);
|
|
142
111
|
const END = 0;
|
|
143
112
|
const NULL = 1;
|
|
144
113
|
const FALSE = 2;
|
|
@@ -211,7 +180,6 @@ function encode$4(value) {
|
|
|
211
180
|
i += part.length;
|
|
212
181
|
}
|
|
213
182
|
}
|
|
214
|
-
addStringify(buffer);
|
|
215
183
|
return buffer;
|
|
216
184
|
}
|
|
217
185
|
const nextKey = /* @__PURE__ */ new WeakMap();
|
|
@@ -294,12 +262,10 @@ function keyStep(key) {
|
|
|
294
262
|
switch (key[l]) {
|
|
295
263
|
case 0:
|
|
296
264
|
newKey = key.slice(0, l);
|
|
297
|
-
addStringify(newKey);
|
|
298
265
|
step = 1;
|
|
299
266
|
break;
|
|
300
267
|
case 255:
|
|
301
268
|
newKey = key.slice(0, l);
|
|
302
|
-
addStringify(newKey);
|
|
303
269
|
newKey[l - 1]++;
|
|
304
270
|
step = -1;
|
|
305
271
|
break;
|
|
@@ -322,7 +288,6 @@ function keyBefore(key) {
|
|
|
322
288
|
newKey[l]--;
|
|
323
289
|
newKey[l + 1] = 255;
|
|
324
290
|
}
|
|
325
|
-
addStringify(newKey);
|
|
326
291
|
return newKey;
|
|
327
292
|
}
|
|
328
293
|
function keyAfter(key) {
|
|
@@ -338,7 +303,6 @@ function keyAfter(key) {
|
|
|
338
303
|
newKey.set(key, 0);
|
|
339
304
|
newKey[l + 1] = 0;
|
|
340
305
|
}
|
|
341
|
-
addStringify(newKey);
|
|
342
306
|
return newKey;
|
|
343
307
|
}
|
|
344
308
|
function decodeBound(bound) {
|
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.10-alpha.
|
|
5
|
+
"version": "0.16.10-alpha.2",
|
|
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.10-alpha.
|
|
21
|
+
"@graffy/stream": "0.16.10-alpha.2"
|
|
22
22
|
}
|
|
23
23
|
}
|