@pezkuwi/util 14.0.25 → 14.0.26
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/bundle-pezkuwi-util.js +165 -153
- package/cjs/format/formatDecimal.js +46 -5
- package/cjs/packageInfo.js +1 -1
- package/format/formatDecimal.js +46 -5
- package/package.json +10 -12
- package/packageInfo.js +1 -1
package/bundle-pezkuwi-util.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
const global = typeof globalThis !== "undefined" ? globalThis : typeof self !== "undefined" ? self : window;
|
|
8
8
|
|
|
9
9
|
var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
|
|
10
|
-
const packageInfo$
|
|
10
|
+
const packageInfo$3 = { name: '@pezkuwi/util', path: (({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href)) }) && (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href))) ? new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href))).pathname.substring(0, new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href))).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '14.0.26' };
|
|
11
11
|
|
|
12
12
|
function arrayChunk(array, chunkSize) {
|
|
13
13
|
const outputSize = Math.ceil(array.length / chunkSize);
|
|
@@ -132,120 +132,66 @@
|
|
|
132
132
|
const nMax = createCmp((a, b) => a > b);
|
|
133
133
|
const nMin = createCmp((a, b) => a < b);
|
|
134
134
|
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
function
|
|
138
|
-
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
get: function () {
|
|
159
|
-
return n[k];
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
return a;
|
|
135
|
+
const packageInfo$2 = { name: '@pezkuwi/x-global', path: (({ url: (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href)) }) && (typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href))) ? new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href))).pathname.substring(0, new URL((typeof document === 'undefined' && typeof location === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : typeof document === 'undefined' ? location.href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('bundle-pezkuwi-util.js', document.baseURI).href))).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '14.0.26' };
|
|
136
|
+
|
|
137
|
+
function evaluateThis(fn) {
|
|
138
|
+
return fn('return this');
|
|
139
|
+
}
|
|
140
|
+
const xglobal = (typeof globalThis !== 'undefined'
|
|
141
|
+
? globalThis
|
|
142
|
+
: typeof global !== 'undefined'
|
|
143
|
+
? global
|
|
144
|
+
: typeof self !== 'undefined'
|
|
145
|
+
? self
|
|
146
|
+
: typeof window !== 'undefined'
|
|
147
|
+
? window
|
|
148
|
+
: evaluateThis(Function));
|
|
149
|
+
function extractGlobal(name, fallback) {
|
|
150
|
+
return typeof xglobal[name] === 'undefined'
|
|
151
|
+
? fallback
|
|
152
|
+
: xglobal[name];
|
|
153
|
+
}
|
|
154
|
+
function exposeGlobal(name, fallback) {
|
|
155
|
+
if (typeof xglobal[name] === 'undefined') {
|
|
156
|
+
xglobal[name] = fallback;
|
|
157
|
+
}
|
|
164
158
|
}
|
|
165
159
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
packageInfo$3.packageInfo = void 0;
|
|
174
|
-
packageInfo$3.packageInfo = { name: '@pezkuwi/x-global', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.23' };
|
|
175
|
-
|
|
176
|
-
(function (exports$1) {
|
|
177
|
-
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
178
|
-
exports$1.xglobal = exports$1.packageInfo = void 0;
|
|
179
|
-
exports$1.extractGlobal = extractGlobal;
|
|
180
|
-
exports$1.exposeGlobal = exposeGlobal;
|
|
181
|
-
var packageInfo_js_1 = packageInfo$3;
|
|
182
|
-
Object.defineProperty(exports$1, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
|
|
183
|
-
function evaluateThis(fn) {
|
|
184
|
-
return fn('return this');
|
|
185
|
-
}
|
|
186
|
-
exports$1.xglobal = (typeof globalThis !== 'undefined'
|
|
187
|
-
? globalThis
|
|
188
|
-
: typeof commonjsGlobal !== 'undefined'
|
|
189
|
-
? commonjsGlobal
|
|
190
|
-
: typeof self !== 'undefined'
|
|
191
|
-
? self
|
|
192
|
-
: typeof window !== 'undefined'
|
|
193
|
-
? window
|
|
194
|
-
: evaluateThis(Function));
|
|
195
|
-
function extractGlobal(name, fallback) {
|
|
196
|
-
return typeof exports$1.xglobal[name] === 'undefined'
|
|
197
|
-
? fallback
|
|
198
|
-
: exports$1.xglobal[name];
|
|
199
|
-
}
|
|
200
|
-
function exposeGlobal(name, fallback) {
|
|
201
|
-
if (typeof exports$1.xglobal[name] === 'undefined') {
|
|
202
|
-
exports$1.xglobal[name] = fallback;
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
} (cjs));
|
|
206
|
-
getDefaultExportFromCjs(cjs);
|
|
207
|
-
|
|
208
|
-
var packageInfo$2 = {};
|
|
209
|
-
|
|
210
|
-
Object.defineProperty(packageInfo$2, "__esModule", { value: true });
|
|
211
|
-
packageInfo$2.packageInfo = void 0;
|
|
212
|
-
packageInfo$2.packageInfo = { name: '@pezkuwi/x-bigint', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.23' };
|
|
160
|
+
const build = /*#__PURE__*/Object.freeze({
|
|
161
|
+
__proto__: null,
|
|
162
|
+
exposeGlobal: exposeGlobal,
|
|
163
|
+
extractGlobal: extractGlobal,
|
|
164
|
+
packageInfo: packageInfo$2,
|
|
165
|
+
xglobal: xglobal
|
|
166
|
+
});
|
|
213
167
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
const
|
|
228
|
-
const
|
|
229
|
-
const
|
|
230
|
-
const
|
|
231
|
-
const
|
|
232
|
-
const
|
|
233
|
-
const
|
|
234
|
-
const _7n = cjs$1.BigInt(7);
|
|
235
|
-
const _8n = cjs$1.BigInt(8);
|
|
236
|
-
const _9n = cjs$1.BigInt(9);
|
|
237
|
-
const _10n = cjs$1.BigInt(10);
|
|
238
|
-
const _100n = cjs$1.BigInt(100);
|
|
239
|
-
const _1000n = cjs$1.BigInt(1_000);
|
|
240
|
-
const _1Mn = cjs$1.BigInt(1_000_000);
|
|
241
|
-
const _1Bn = cjs$1.BigInt(1_000_000_000);
|
|
168
|
+
function invalidFallback() {
|
|
169
|
+
return Number.NaN;
|
|
170
|
+
}
|
|
171
|
+
const BigInt = extractGlobal('BigInt', invalidFallback);
|
|
172
|
+
|
|
173
|
+
const _0n = BigInt(0);
|
|
174
|
+
const _1n = BigInt(1);
|
|
175
|
+
const _2n = BigInt(2);
|
|
176
|
+
const _3n = BigInt(3);
|
|
177
|
+
const _4n = BigInt(4);
|
|
178
|
+
const _5n = BigInt(5);
|
|
179
|
+
const _6n = BigInt(6);
|
|
180
|
+
const _7n = BigInt(7);
|
|
181
|
+
const _8n = BigInt(8);
|
|
182
|
+
const _9n = BigInt(9);
|
|
183
|
+
const _10n = BigInt(10);
|
|
184
|
+
const _100n = BigInt(100);
|
|
185
|
+
const _1000n = BigInt(1_000);
|
|
186
|
+
const _1Mn = BigInt(1_000_000);
|
|
187
|
+
const _1Bn = BigInt(1_000_000_000);
|
|
242
188
|
const _1Qn = _1Bn * _1Bn;
|
|
243
|
-
const _2pow53n =
|
|
244
|
-
const _sqrt2pow53n =
|
|
189
|
+
const _2pow53n = BigInt(Number.MAX_SAFE_INTEGER);
|
|
190
|
+
const _sqrt2pow53n = BigInt(94906265);
|
|
245
191
|
|
|
246
|
-
const U8_MAX =
|
|
247
|
-
const U16_MAX =
|
|
248
|
-
const U64_MAX =
|
|
192
|
+
const U8_MAX = BigInt(256);
|
|
193
|
+
const U16_MAX = BigInt(256 * 256);
|
|
194
|
+
const U64_MAX = BigInt('0x10000000000000000');
|
|
249
195
|
function u8aToBigInt(value, { isLe = true, isNegative = false } = {}) {
|
|
250
196
|
if (!isLe) {
|
|
251
197
|
value = value.slice().reverse();
|
|
@@ -254,37 +200,37 @@
|
|
|
254
200
|
if (isNegative && count && (value[count - 1] & 0x80)) {
|
|
255
201
|
switch (count) {
|
|
256
202
|
case 0:
|
|
257
|
-
return
|
|
203
|
+
return BigInt(0);
|
|
258
204
|
case 1:
|
|
259
|
-
return
|
|
205
|
+
return BigInt(((value[0] ^ 0x0000_00ff) * -1) - 1);
|
|
260
206
|
case 2:
|
|
261
|
-
return
|
|
207
|
+
return BigInt((((value[0] + (value[1] << 8)) ^ 0x0000_ffff) * -1) - 1);
|
|
262
208
|
case 4:
|
|
263
|
-
return
|
|
209
|
+
return BigInt((((value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00)) ^ 0xffff_ffff) * -1) - 1);
|
|
264
210
|
}
|
|
265
211
|
const dvI = new DataView(value.buffer, value.byteOffset);
|
|
266
212
|
if (count === 8) {
|
|
267
213
|
return dvI.getBigInt64(0, true);
|
|
268
214
|
}
|
|
269
|
-
let result =
|
|
215
|
+
let result = BigInt(0);
|
|
270
216
|
const mod = count % 2;
|
|
271
217
|
for (let i = count - 2; i >= mod; i -= 2) {
|
|
272
|
-
result = (result * U16_MAX) +
|
|
218
|
+
result = (result * U16_MAX) + BigInt(dvI.getUint16(i, true) ^ 0xffff);
|
|
273
219
|
}
|
|
274
220
|
if (mod) {
|
|
275
|
-
result = (result * U8_MAX) +
|
|
221
|
+
result = (result * U8_MAX) + BigInt(value[0] ^ 0xff);
|
|
276
222
|
}
|
|
277
223
|
return (result * -_1n) - _1n;
|
|
278
224
|
}
|
|
279
225
|
switch (count) {
|
|
280
226
|
case 0:
|
|
281
|
-
return
|
|
227
|
+
return BigInt(0);
|
|
282
228
|
case 1:
|
|
283
|
-
return
|
|
229
|
+
return BigInt(value[0]);
|
|
284
230
|
case 2:
|
|
285
|
-
return
|
|
231
|
+
return BigInt(value[0] + (value[1] << 8));
|
|
286
232
|
case 4:
|
|
287
|
-
return
|
|
233
|
+
return BigInt(value[0] + (value[1] << 8) + (value[2] << 16) + (value[3] * 0x1_00_00_00));
|
|
288
234
|
}
|
|
289
235
|
const dvI = new DataView(value.buffer, value.byteOffset);
|
|
290
236
|
switch (count) {
|
|
@@ -293,13 +239,13 @@
|
|
|
293
239
|
case 16:
|
|
294
240
|
return (dvI.getBigUint64(8, true) * U64_MAX) + dvI.getBigUint64(0, true);
|
|
295
241
|
default: {
|
|
296
|
-
let result =
|
|
242
|
+
let result = BigInt(0);
|
|
297
243
|
const mod = count % 2;
|
|
298
244
|
for (let i = count - 2; i >= mod; i -= 2) {
|
|
299
|
-
result = (result * U16_MAX) +
|
|
245
|
+
result = (result * U16_MAX) + BigInt(dvI.getUint16(i, true));
|
|
300
246
|
}
|
|
301
247
|
if (mod) {
|
|
302
|
-
result = (result * U8_MAX) +
|
|
248
|
+
result = (result * U8_MAX) + BigInt(value[0]);
|
|
303
249
|
}
|
|
304
250
|
return result;
|
|
305
251
|
}
|
|
@@ -344,10 +290,41 @@
|
|
|
344
290
|
|
|
345
291
|
function hexToBigInt(value, { isLe = false, isNegative = false } = {}) {
|
|
346
292
|
return !value || value === '0x'
|
|
347
|
-
?
|
|
293
|
+
? BigInt(0)
|
|
348
294
|
: u8aToBigInt(hexToU8a(value), { isLe, isNegative });
|
|
349
295
|
}
|
|
350
296
|
|
|
297
|
+
var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
|
|
298
|
+
|
|
299
|
+
function getDefaultExportFromCjs (x) {
|
|
300
|
+
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
function getAugmentedNamespace(n) {
|
|
304
|
+
if (n.__esModule) return n;
|
|
305
|
+
var f = n.default;
|
|
306
|
+
if (typeof f == "function") {
|
|
307
|
+
var a = function a () {
|
|
308
|
+
if (this instanceof a) {
|
|
309
|
+
return Reflect.construct(f, arguments, this.constructor);
|
|
310
|
+
}
|
|
311
|
+
return f.apply(this, arguments);
|
|
312
|
+
};
|
|
313
|
+
a.prototype = f.prototype;
|
|
314
|
+
} else a = {};
|
|
315
|
+
Object.defineProperty(a, '__esModule', {value: true});
|
|
316
|
+
Object.keys(n).forEach(function (k) {
|
|
317
|
+
var d = Object.getOwnPropertyDescriptor(n, k);
|
|
318
|
+
Object.defineProperty(a, k, d.get ? d : {
|
|
319
|
+
enumerable: true,
|
|
320
|
+
get: function () {
|
|
321
|
+
return n[k];
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
});
|
|
325
|
+
return a;
|
|
326
|
+
}
|
|
327
|
+
|
|
351
328
|
var bn = {exports: {}};
|
|
352
329
|
|
|
353
330
|
const _nodeResolve_empty = {};
|
|
@@ -357,7 +334,7 @@
|
|
|
357
334
|
default: _nodeResolve_empty
|
|
358
335
|
});
|
|
359
336
|
|
|
360
|
-
const require$$0 = /*@__PURE__*/getAugmentedNamespace(_nodeResolve_empty$1);
|
|
337
|
+
const require$$0$1 = /*@__PURE__*/getAugmentedNamespace(_nodeResolve_empty$1);
|
|
361
338
|
|
|
362
339
|
bn.exports;
|
|
363
340
|
(function (module) {
|
|
@@ -400,7 +377,7 @@
|
|
|
400
377
|
if (typeof window !== 'undefined' && typeof window.Buffer !== 'undefined') {
|
|
401
378
|
Buffer = window.Buffer;
|
|
402
379
|
} else {
|
|
403
|
-
Buffer = require$$0.Buffer;
|
|
380
|
+
Buffer = require$$0$1.Buffer;
|
|
404
381
|
}
|
|
405
382
|
} catch (e) {
|
|
406
383
|
}
|
|
@@ -3074,16 +3051,16 @@
|
|
|
3074
3051
|
return typeof value === 'bigint'
|
|
3075
3052
|
? value
|
|
3076
3053
|
: !value
|
|
3077
|
-
?
|
|
3054
|
+
? BigInt(0)
|
|
3078
3055
|
: isHex(value)
|
|
3079
3056
|
? hexToBigInt(value.toString())
|
|
3080
3057
|
: isBn(value)
|
|
3081
|
-
?
|
|
3058
|
+
? BigInt(value.toString())
|
|
3082
3059
|
: isToBigInt(value)
|
|
3083
3060
|
? value.toBigInt()
|
|
3084
3061
|
: isToBn(value)
|
|
3085
|
-
?
|
|
3086
|
-
:
|
|
3062
|
+
? BigInt(value.toBn().toString())
|
|
3063
|
+
: BigInt(value);
|
|
3087
3064
|
}
|
|
3088
3065
|
|
|
3089
3066
|
function nSqrt(value) {
|
|
@@ -3092,7 +3069,7 @@
|
|
|
3092
3069
|
throw new Error('square root of negative numbers is not supported');
|
|
3093
3070
|
}
|
|
3094
3071
|
if (n <= _2pow53n) {
|
|
3095
|
-
return
|
|
3072
|
+
return BigInt(~~Math.sqrt(Number(n)));
|
|
3096
3073
|
}
|
|
3097
3074
|
let x0 = _sqrt2pow53n;
|
|
3098
3075
|
while (true) {
|
|
@@ -3104,16 +3081,16 @@
|
|
|
3104
3081
|
}
|
|
3105
3082
|
}
|
|
3106
3083
|
|
|
3107
|
-
const hasBigInt = typeof
|
|
3084
|
+
const hasBigInt = typeof BigInt === 'function' && typeof BigInt.asIntN === 'function';
|
|
3108
3085
|
const hasCjs = typeof require === 'function' && typeof module !== 'undefined';
|
|
3109
3086
|
const hasDirname = typeof __dirname !== 'undefined';
|
|
3110
3087
|
const hasEsm = !hasCjs;
|
|
3111
3088
|
const hasWasm = typeof WebAssembly !== 'undefined';
|
|
3112
|
-
const hasBuffer = typeof
|
|
3113
|
-
const hasProcess = typeof
|
|
3089
|
+
const hasBuffer = typeof xglobal.Buffer === 'function' && typeof xglobal.Buffer.isBuffer === 'function';
|
|
3090
|
+
const hasProcess = typeof xglobal.process === 'object';
|
|
3114
3091
|
|
|
3115
3092
|
function isBuffer(value) {
|
|
3116
|
-
return hasBuffer && !!value && isFunction(value.readDoubleLE) &&
|
|
3093
|
+
return hasBuffer && !!value && isFunction(value.readDoubleLE) && xglobal.Buffer.isBuffer(value);
|
|
3117
3094
|
}
|
|
3118
3095
|
|
|
3119
3096
|
function isU8a(value) {
|
|
@@ -3123,6 +3100,8 @@
|
|
|
3123
3100
|
|
|
3124
3101
|
var browser$1 = {};
|
|
3125
3102
|
|
|
3103
|
+
const require$$0 = /*@__PURE__*/getAugmentedNamespace(build);
|
|
3104
|
+
|
|
3126
3105
|
var fallback$1 = {};
|
|
3127
3106
|
|
|
3128
3107
|
Object.defineProperty(fallback$1, "__esModule", { value: true });
|
|
@@ -3143,12 +3122,12 @@
|
|
|
3143
3122
|
|
|
3144
3123
|
Object.defineProperty(packageInfo$1, "__esModule", { value: true });
|
|
3145
3124
|
packageInfo$1.packageInfo = void 0;
|
|
3146
|
-
packageInfo$1.packageInfo = { name: '@pezkuwi/x-textencoder', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.
|
|
3125
|
+
packageInfo$1.packageInfo = { name: '@pezkuwi/x-textencoder', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.26' };
|
|
3147
3126
|
|
|
3148
3127
|
(function (exports$1) {
|
|
3149
3128
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
3150
3129
|
exports$1.TextEncoder = exports$1.packageInfo = void 0;
|
|
3151
|
-
const x_global_1 =
|
|
3130
|
+
const x_global_1 = require$$0;
|
|
3152
3131
|
const fallback_js_1 = fallback$1;
|
|
3153
3132
|
var packageInfo_js_1 = packageInfo$1;
|
|
3154
3133
|
Object.defineProperty(exports$1, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
|
|
@@ -3326,7 +3305,7 @@
|
|
|
3326
3305
|
|
|
3327
3306
|
function u8aToBuffer(value) {
|
|
3328
3307
|
return hasBuffer
|
|
3329
|
-
?
|
|
3308
|
+
? xglobal.Buffer.from(value || [])
|
|
3330
3309
|
: new Uint8Array(value || []);
|
|
3331
3310
|
}
|
|
3332
3311
|
|
|
@@ -3451,12 +3430,12 @@
|
|
|
3451
3430
|
|
|
3452
3431
|
Object.defineProperty(packageInfo, "__esModule", { value: true });
|
|
3453
3432
|
packageInfo.packageInfo = void 0;
|
|
3454
|
-
packageInfo.packageInfo = { name: '@pezkuwi/x-textdecoder', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.
|
|
3433
|
+
packageInfo.packageInfo = { name: '@pezkuwi/x-textdecoder', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.26' };
|
|
3455
3434
|
|
|
3456
3435
|
(function (exports$1) {
|
|
3457
3436
|
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
3458
3437
|
exports$1.TextDecoder = exports$1.packageInfo = void 0;
|
|
3459
|
-
const x_global_1 =
|
|
3438
|
+
const x_global_1 = require$$0;
|
|
3460
3439
|
const fallback_js_1 = fallback;
|
|
3461
3440
|
var packageInfo_js_1 = packageInfo;
|
|
3462
3441
|
Object.defineProperty(exports$1, "packageInfo", { enumerable: true, get: function () { return packageInfo_js_1.packageInfo; } });
|
|
@@ -3496,8 +3475,8 @@
|
|
|
3496
3475
|
: u8aConcatStrict([U8A_WRAP_PREFIX, u8a, U8A_WRAP_POSTFIX]);
|
|
3497
3476
|
}
|
|
3498
3477
|
|
|
3499
|
-
const DIV =
|
|
3500
|
-
const NEG_MASK =
|
|
3478
|
+
const DIV = BigInt(256);
|
|
3479
|
+
const NEG_MASK = BigInt(0xff);
|
|
3501
3480
|
function toU8a(value, isLe, isNegative) {
|
|
3502
3481
|
const arr = [];
|
|
3503
3482
|
const withSigned = isNegative && (value < _0n);
|
|
@@ -3750,7 +3729,7 @@
|
|
|
3750
3729
|
const DEDUPE = 'Either remove and explicitly install matching versions or dedupe using your package manager.\nThe following conflicting packages were found:';
|
|
3751
3730
|
const POLKADOTJS_DISABLE_ESM_CJS_WARNING_FLAG = 'POLKADOTJS_DISABLE_ESM_CJS_WARNING';
|
|
3752
3731
|
function getEntry(name) {
|
|
3753
|
-
const _global =
|
|
3732
|
+
const _global = xglobal;
|
|
3754
3733
|
if (!_global.__polkadotjs) {
|
|
3755
3734
|
_global.__polkadotjs = {};
|
|
3756
3735
|
}
|
|
@@ -3814,7 +3793,7 @@
|
|
|
3814
3793
|
const entry = getEntry(name);
|
|
3815
3794
|
entry.push({ path: getPath(path, pathOrFn), type, version });
|
|
3816
3795
|
const entriesSameVersion = entry.every((e) => e.version === version);
|
|
3817
|
-
const esmCjsWarningDisabled =
|
|
3796
|
+
const esmCjsWarningDisabled = xglobal.process?.env?.[POLKADOTJS_DISABLE_ESM_CJS_WARNING_FLAG] === '1';
|
|
3818
3797
|
const multipleEntries = entry.length !== 1;
|
|
3819
3798
|
const disableWarnings = esmCjsWarningDisabled && entriesSameVersion;
|
|
3820
3799
|
if (multipleEntries && !disableWarnings) {
|
|
@@ -3887,13 +3866,46 @@
|
|
|
3887
3866
|
return typeof value === 'boolean';
|
|
3888
3867
|
}
|
|
3889
3868
|
|
|
3890
|
-
|
|
3869
|
+
function isDigit(c) {
|
|
3870
|
+
return c >= '0' && c <= '9';
|
|
3871
|
+
}
|
|
3872
|
+
function groups(value) {
|
|
3873
|
+
const out = [];
|
|
3874
|
+
const end = value.length;
|
|
3875
|
+
let i = 0;
|
|
3876
|
+
while (i < end) {
|
|
3877
|
+
if (!isDigit(value[i])) {
|
|
3878
|
+
i++;
|
|
3879
|
+
continue;
|
|
3880
|
+
}
|
|
3881
|
+
let j = i;
|
|
3882
|
+
while (j < end && isDigit(value[j])) {
|
|
3883
|
+
j++;
|
|
3884
|
+
}
|
|
3885
|
+
let start = i;
|
|
3886
|
+
while (start < j) {
|
|
3887
|
+
let stop = -1;
|
|
3888
|
+
for (let q = start + 1; q <= j; q++) {
|
|
3889
|
+
const left = j - q;
|
|
3890
|
+
if ((left > 0 && left % 3 === 0) || (left === 0 && j === end)) {
|
|
3891
|
+
stop = q;
|
|
3892
|
+
break;
|
|
3893
|
+
}
|
|
3894
|
+
}
|
|
3895
|
+
if (stop === -1) {
|
|
3896
|
+
break;
|
|
3897
|
+
}
|
|
3898
|
+
out.push(value.slice(start, stop));
|
|
3899
|
+
start = stop;
|
|
3900
|
+
}
|
|
3901
|
+
i = j;
|
|
3902
|
+
}
|
|
3903
|
+
return out;
|
|
3904
|
+
}
|
|
3891
3905
|
function formatDecimal(value, separator = ',') {
|
|
3892
3906
|
const isNegative = value[0].startsWith('-');
|
|
3893
|
-
const matched = isNegative
|
|
3894
|
-
|
|
3895
|
-
: value.match(NUMBER_REGEX);
|
|
3896
|
-
return matched
|
|
3907
|
+
const matched = groups(isNegative ? value.substring(1) : value);
|
|
3908
|
+
return matched.length
|
|
3897
3909
|
? `${isNegative ? '-' : ''}${matched.join(separator)}`
|
|
3898
3910
|
: value;
|
|
3899
3911
|
}
|
|
@@ -4470,9 +4482,9 @@
|
|
|
4470
4482
|
return flag;
|
|
4471
4483
|
}
|
|
4472
4484
|
function parseEnv(type) {
|
|
4473
|
-
const maxSize = parseInt(
|
|
4485
|
+
const maxSize = parseInt(xglobal.process?.env?.['DEBUG_MAX'] || '-1', 10);
|
|
4474
4486
|
return [
|
|
4475
|
-
getDebugFlag((
|
|
4487
|
+
getDebugFlag((xglobal.process?.env?.['DEBUG'] || '').toLowerCase().split(','), type),
|
|
4476
4488
|
isNaN(maxSize)
|
|
4477
4489
|
? -1
|
|
4478
4490
|
: maxSize
|
|
@@ -4819,7 +4831,7 @@
|
|
|
4819
4831
|
exports.objectProperty = objectProperty;
|
|
4820
4832
|
exports.objectSpread = objectSpread;
|
|
4821
4833
|
exports.objectValues = objectValues;
|
|
4822
|
-
exports.packageInfo = packageInfo$
|
|
4834
|
+
exports.packageInfo = packageInfo$3;
|
|
4823
4835
|
exports.promisify = promisify;
|
|
4824
4836
|
exports.stringCamelCase = stringCamelCase;
|
|
4825
4837
|
exports.stringLowerFirst = stringLowerFirst;
|
|
@@ -1,7 +1,50 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.formatDecimal = formatDecimal;
|
|
4
|
-
|
|
4
|
+
function isDigit(c) {
|
|
5
|
+
return c >= '0' && c <= '9';
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Splits the digits of value into thousands groups, exactly as the pattern
|
|
9
|
+
* /(\d+?)(?=(\d{3})+(?!\d)|$)/g matched them, without its quadratic cost
|
|
10
|
+
* on long digit runs (CodeQL js/polynomial-redos): within each run of digits,
|
|
11
|
+
* a group ends where the digits left in the run are a positive multiple of
|
|
12
|
+
* three, or at the end of the string. A run that never reaches such a point
|
|
13
|
+
* (two digits followed by a letter, say) contributes nothing.
|
|
14
|
+
*/
|
|
15
|
+
function groups(value) {
|
|
16
|
+
const out = [];
|
|
17
|
+
const end = value.length;
|
|
18
|
+
let i = 0;
|
|
19
|
+
while (i < end) {
|
|
20
|
+
if (!isDigit(value[i])) {
|
|
21
|
+
i++;
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
let j = i;
|
|
25
|
+
while (j < end && isDigit(value[j])) {
|
|
26
|
+
j++;
|
|
27
|
+
}
|
|
28
|
+
let start = i;
|
|
29
|
+
while (start < j) {
|
|
30
|
+
let stop = -1;
|
|
31
|
+
for (let q = start + 1; q <= j; q++) {
|
|
32
|
+
const left = j - q;
|
|
33
|
+
if ((left > 0 && left % 3 === 0) || (left === 0 && j === end)) {
|
|
34
|
+
stop = q;
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
if (stop === -1) {
|
|
39
|
+
break;
|
|
40
|
+
}
|
|
41
|
+
out.push(value.slice(start, stop));
|
|
42
|
+
start = stop;
|
|
43
|
+
}
|
|
44
|
+
i = j;
|
|
45
|
+
}
|
|
46
|
+
return out;
|
|
47
|
+
}
|
|
5
48
|
/**
|
|
6
49
|
* @name formatDecimal
|
|
7
50
|
* @description Formats a number into string format with thousand separators
|
|
@@ -10,10 +53,8 @@ function formatDecimal(value, separator = ',') {
|
|
|
10
53
|
// We can do this by adjusting the regx, however for the sake of clarity
|
|
11
54
|
// we rather strip and re-add the negative sign in the output
|
|
12
55
|
const isNegative = value[0].startsWith('-');
|
|
13
|
-
const matched = isNegative
|
|
14
|
-
|
|
15
|
-
: value.match(NUMBER_REGEX);
|
|
16
|
-
return matched
|
|
56
|
+
const matched = groups(isNegative ? value.substring(1) : value);
|
|
57
|
+
return matched.length
|
|
17
58
|
? `${isNegative ? '-' : ''}${matched.join(separator)}`
|
|
18
59
|
: value;
|
|
19
60
|
}
|
package/cjs/packageInfo.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.packageInfo = void 0;
|
|
4
|
-
exports.packageInfo = { name: '@pezkuwi/util', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.
|
|
4
|
+
exports.packageInfo = { name: '@pezkuwi/util', path: typeof __dirname === 'string' ? __dirname : 'auto', type: 'cjs', version: '14.0.26' };
|
package/format/formatDecimal.js
CHANGED
|
@@ -1,4 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
function isDigit(c) {
|
|
2
|
+
return c >= '0' && c <= '9';
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Splits the digits of value into thousands groups, exactly as the pattern
|
|
6
|
+
* /(\d+?)(?=(\d{3})+(?!\d)|$)/g matched them, without its quadratic cost
|
|
7
|
+
* on long digit runs (CodeQL js/polynomial-redos): within each run of digits,
|
|
8
|
+
* a group ends where the digits left in the run are a positive multiple of
|
|
9
|
+
* three, or at the end of the string. A run that never reaches such a point
|
|
10
|
+
* (two digits followed by a letter, say) contributes nothing.
|
|
11
|
+
*/
|
|
12
|
+
function groups(value) {
|
|
13
|
+
const out = [];
|
|
14
|
+
const end = value.length;
|
|
15
|
+
let i = 0;
|
|
16
|
+
while (i < end) {
|
|
17
|
+
if (!isDigit(value[i])) {
|
|
18
|
+
i++;
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
let j = i;
|
|
22
|
+
while (j < end && isDigit(value[j])) {
|
|
23
|
+
j++;
|
|
24
|
+
}
|
|
25
|
+
let start = i;
|
|
26
|
+
while (start < j) {
|
|
27
|
+
let stop = -1;
|
|
28
|
+
for (let q = start + 1; q <= j; q++) {
|
|
29
|
+
const left = j - q;
|
|
30
|
+
if ((left > 0 && left % 3 === 0) || (left === 0 && j === end)) {
|
|
31
|
+
stop = q;
|
|
32
|
+
break;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
if (stop === -1) {
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
out.push(value.slice(start, stop));
|
|
39
|
+
start = stop;
|
|
40
|
+
}
|
|
41
|
+
i = j;
|
|
42
|
+
}
|
|
43
|
+
return out;
|
|
44
|
+
}
|
|
2
45
|
/**
|
|
3
46
|
* @name formatDecimal
|
|
4
47
|
* @description Formats a number into string format with thousand separators
|
|
@@ -7,10 +50,8 @@ export function formatDecimal(value, separator = ',') {
|
|
|
7
50
|
// We can do this by adjusting the regx, however for the sake of clarity
|
|
8
51
|
// we rather strip and re-add the negative sign in the output
|
|
9
52
|
const isNegative = value[0].startsWith('-');
|
|
10
|
-
const matched = isNegative
|
|
11
|
-
|
|
12
|
-
: value.match(NUMBER_REGEX);
|
|
13
|
-
return matched
|
|
53
|
+
const matched = groups(isNegative ? value.substring(1) : value);
|
|
54
|
+
return matched.length
|
|
14
55
|
? `${isNegative ? '-' : ''}${matched.join(separator)}`
|
|
15
56
|
: value;
|
|
16
57
|
}
|
package/package.json
CHANGED
|
@@ -1,37 +1,35 @@
|
|
|
1
1
|
{
|
|
2
2
|
"author": "Dijital Kurdistan Tech Institute <dev@pezkuwichain.io>",
|
|
3
|
-
"bugs": "https://
|
|
3
|
+
"bugs": "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-common/issues",
|
|
4
4
|
"description": "A collection of useful utilities for @pezkuwi",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=18"
|
|
7
7
|
},
|
|
8
|
-
"homepage": "https://
|
|
8
|
+
"homepage": "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-common/tree/master/packages/util#readme",
|
|
9
9
|
"license": "Apache-2.0",
|
|
10
10
|
"name": "@pezkuwi/util",
|
|
11
11
|
"repository": {
|
|
12
12
|
"directory": "packages/util",
|
|
13
13
|
"type": "git",
|
|
14
|
-
"url": "https://
|
|
14
|
+
"url": "https://git.pezkuwichain.io/pezkuwichain/pezkuwi-common.git"
|
|
15
15
|
},
|
|
16
16
|
"sideEffects": [
|
|
17
17
|
"./packageDetect.js",
|
|
18
18
|
"./cjs/packageDetect.js"
|
|
19
19
|
],
|
|
20
20
|
"type": "module",
|
|
21
|
-
"version": "14.0.
|
|
21
|
+
"version": "14.0.26",
|
|
22
22
|
"main": "./cjs/index.js",
|
|
23
|
-
"module": "./
|
|
24
|
-
"types": "./
|
|
23
|
+
"module": "./index.js",
|
|
24
|
+
"types": "./index.d.ts",
|
|
25
25
|
"exports": {
|
|
26
26
|
"./cjs/package.json": "./cjs/package.json",
|
|
27
27
|
"./cjs/*": "./cjs/*.js",
|
|
28
28
|
".": {
|
|
29
|
-
"types": "./index.d.ts",
|
|
30
29
|
"module": {
|
|
31
30
|
"types": "./index.d.ts",
|
|
32
31
|
"default": "./index.js"
|
|
33
32
|
},
|
|
34
|
-
"import": "./index.js",
|
|
35
33
|
"require": {
|
|
36
34
|
"types": "./cjs/index.d.ts",
|
|
37
35
|
"default": "./cjs/index.js"
|
|
@@ -1987,10 +1985,10 @@
|
|
|
1987
1985
|
}
|
|
1988
1986
|
},
|
|
1989
1987
|
"dependencies": {
|
|
1990
|
-
"@pezkuwi/x-bigint": "14.0.
|
|
1991
|
-
"@pezkuwi/x-global": "14.0.
|
|
1992
|
-
"@pezkuwi/x-textdecoder": "14.0.
|
|
1993
|
-
"@pezkuwi/x-textencoder": "14.0.
|
|
1988
|
+
"@pezkuwi/x-bigint": "14.0.26",
|
|
1989
|
+
"@pezkuwi/x-global": "14.0.26",
|
|
1990
|
+
"@pezkuwi/x-textdecoder": "14.0.26",
|
|
1991
|
+
"@pezkuwi/x-textencoder": "14.0.26",
|
|
1994
1992
|
"@types/bn.js": "^5.1.6",
|
|
1995
1993
|
"bn.js": "^5.2.1",
|
|
1996
1994
|
"tslib": "^2.8.0"
|
package/packageInfo.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const packageInfo = { name: '@pezkuwi/util', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '14.0.
|
|
1
|
+
export const packageInfo = { name: '@pezkuwi/util', path: (import.meta && import.meta.url) ? new URL(import.meta.url).pathname.substring(0, new URL(import.meta.url).pathname.lastIndexOf('/') + 1) : 'auto', type: 'esm', version: '14.0.26' };
|