@graffy/common 0.16.9 → 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 -34
- package/index.mjs +0 -34
- package/package.json +2 -2
package/index.cjs
CHANGED
|
@@ -107,38 +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 ("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
111
|
return buffer;
|
|
139
112
|
}
|
|
140
|
-
addStringify(MIN_KEY);
|
|
141
|
-
addStringify(MAX_KEY);
|
|
142
113
|
const END = 0;
|
|
143
114
|
const NULL = 1;
|
|
144
115
|
const FALSE = 2;
|
|
@@ -211,7 +182,6 @@ function encode$4(value) {
|
|
|
211
182
|
i += part.length;
|
|
212
183
|
}
|
|
213
184
|
}
|
|
214
|
-
addStringify(buffer);
|
|
215
185
|
return buffer;
|
|
216
186
|
}
|
|
217
187
|
const nextKey = /* @__PURE__ */ new WeakMap();
|
|
@@ -294,12 +264,10 @@ function keyStep(key) {
|
|
|
294
264
|
switch (key[l]) {
|
|
295
265
|
case 0:
|
|
296
266
|
newKey = key.slice(0, l);
|
|
297
|
-
addStringify(newKey);
|
|
298
267
|
step = 1;
|
|
299
268
|
break;
|
|
300
269
|
case 255:
|
|
301
270
|
newKey = key.slice(0, l);
|
|
302
|
-
addStringify(newKey);
|
|
303
271
|
newKey[l - 1]++;
|
|
304
272
|
step = -1;
|
|
305
273
|
break;
|
|
@@ -322,7 +290,6 @@ function keyBefore(key) {
|
|
|
322
290
|
newKey[l]--;
|
|
323
291
|
newKey[l + 1] = 255;
|
|
324
292
|
}
|
|
325
|
-
addStringify(newKey);
|
|
326
293
|
return newKey;
|
|
327
294
|
}
|
|
328
295
|
function keyAfter(key) {
|
|
@@ -338,7 +305,6 @@ function keyAfter(key) {
|
|
|
338
305
|
newKey.set(key, 0);
|
|
339
306
|
newKey[l + 1] = 0;
|
|
340
307
|
}
|
|
341
|
-
addStringify(newKey);
|
|
342
308
|
return newKey;
|
|
343
309
|
}
|
|
344
310
|
function decodeBound(bound) {
|
package/index.mjs
CHANGED
|
@@ -105,38 +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 ("toJSON" in buffer || Symbol.for("nodejs.util.inspect.custom") in buffer) {
|
|
129
|
-
return buffer;
|
|
130
|
-
}
|
|
131
|
-
Object.defineProperties(buffer, {
|
|
132
|
-
toJSON: stringifyDescriptor,
|
|
133
|
-
toString: stringifyDescriptor,
|
|
134
|
-
[Symbol.for("nodejs.util.inspect.custom")]: stringifyDescriptor
|
|
135
|
-
});
|
|
136
109
|
return buffer;
|
|
137
110
|
}
|
|
138
|
-
addStringify(MIN_KEY);
|
|
139
|
-
addStringify(MAX_KEY);
|
|
140
111
|
const END = 0;
|
|
141
112
|
const NULL = 1;
|
|
142
113
|
const FALSE = 2;
|
|
@@ -209,7 +180,6 @@ function encode$4(value) {
|
|
|
209
180
|
i += part.length;
|
|
210
181
|
}
|
|
211
182
|
}
|
|
212
|
-
addStringify(buffer);
|
|
213
183
|
return buffer;
|
|
214
184
|
}
|
|
215
185
|
const nextKey = /* @__PURE__ */ new WeakMap();
|
|
@@ -292,12 +262,10 @@ function keyStep(key) {
|
|
|
292
262
|
switch (key[l]) {
|
|
293
263
|
case 0:
|
|
294
264
|
newKey = key.slice(0, l);
|
|
295
|
-
addStringify(newKey);
|
|
296
265
|
step = 1;
|
|
297
266
|
break;
|
|
298
267
|
case 255:
|
|
299
268
|
newKey = key.slice(0, l);
|
|
300
|
-
addStringify(newKey);
|
|
301
269
|
newKey[l - 1]++;
|
|
302
270
|
step = -1;
|
|
303
271
|
break;
|
|
@@ -320,7 +288,6 @@ function keyBefore(key) {
|
|
|
320
288
|
newKey[l]--;
|
|
321
289
|
newKey[l + 1] = 255;
|
|
322
290
|
}
|
|
323
|
-
addStringify(newKey);
|
|
324
291
|
return newKey;
|
|
325
292
|
}
|
|
326
293
|
function keyAfter(key) {
|
|
@@ -336,7 +303,6 @@ function keyAfter(key) {
|
|
|
336
303
|
newKey.set(key, 0);
|
|
337
304
|
newKey[l + 1] = 0;
|
|
338
305
|
}
|
|
339
|
-
addStringify(newKey);
|
|
340
306
|
return newKey;
|
|
341
307
|
}
|
|
342
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.
|
|
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.
|
|
21
|
+
"@graffy/stream": "0.16.10-alpha.2"
|
|
22
22
|
}
|
|
23
23
|
}
|