@vbarbarosh/node-helpers 3.62.0 → 3.63.1

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.
@@ -0,0 +1,1594 @@
1
+ /******/ (() => { // webpackBootstrap
2
+ /******/ var __webpack_modules__ = ({
3
+
4
+ /***/ "./node_modules/json-stringify-safe/stringify.js":
5
+ /*!*******************************************************!*\
6
+ !*** ./node_modules/json-stringify-safe/stringify.js ***!
7
+ \*******************************************************/
8
+ /***/ ((module, exports) => {
9
+
10
+ exports = module.exports = stringify
11
+ exports.getSerialize = serializer
12
+
13
+ function stringify(obj, replacer, spaces, cycleReplacer) {
14
+ return JSON.stringify(obj, serializer(replacer, cycleReplacer), spaces)
15
+ }
16
+
17
+ function serializer(replacer, cycleReplacer) {
18
+ var stack = [], keys = []
19
+
20
+ if (cycleReplacer == null) cycleReplacer = function(key, value) {
21
+ if (stack[0] === value) return "[Circular ~]"
22
+ return "[Circular ~." + keys.slice(0, stack.indexOf(value)).join(".") + "]"
23
+ }
24
+
25
+ return function(key, value) {
26
+ if (stack.length > 0) {
27
+ var thisPos = stack.indexOf(this)
28
+ ~thisPos ? stack.splice(thisPos + 1) : stack.push(this)
29
+ ~thisPos ? keys.splice(thisPos, Infinity, key) : keys.push(key)
30
+ if (~stack.indexOf(value)) value = cycleReplacer.call(this, key, value)
31
+ }
32
+ else stack.push(value)
33
+
34
+ return replacer == null ? value : replacer.call(this, key, value)
35
+ }
36
+ }
37
+
38
+
39
+ /***/ }),
40
+
41
+ /***/ "./src sync recursive \\b(array%7Cdate%7Chttp_delete%7Chttp_get_blob%7Chttp_get_buffer%7Chttp_get_json%7Chttp_get_utf8%7Chttp_head%7Chttp_patch_json%7Chttp_post_json%7Chttp_post_multipart%7Chttp_put_buffer%7Chttp_put_json%7Chttp_put_utf8%7Cidentity%7Cignore%7Cformat%7Cplural%7Crandom_int%7Curlmod%7Cwaitcb)[^/]*(?<%21\\.test)\\.js$":
42
+ /*!***************************************************************************************************************************************************************************************************************************************************************************************************************************************!*\
43
+ !*** ./src/ sync \b(array%7Cdate%7Chttp_delete%7Chttp_get_blob%7Chttp_get_buffer%7Chttp_get_json%7Chttp_get_utf8%7Chttp_head%7Chttp_patch_json%7Chttp_post_json%7Chttp_post_multipart%7Chttp_put_buffer%7Chttp_put_json%7Chttp_put_utf8%7Cidentity%7Cignore%7Cformat%7Cplural%7Crandom_int%7Curlmod%7Cwaitcb)[^/]*(?<%21\.test)\.js$ ***!
44
+ \***************************************************************************************************************************************************************************************************************************************************************************************************************************************/
45
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
46
+
47
+ var map = {
48
+ "./array_chunk.js": "./src/array_chunk.js",
49
+ "./array_gcd.js": "./src/array_gcd.js",
50
+ "./array_group.js": "./src/array_group.js",
51
+ "./array_group_map.js": "./src/array_group_map.js",
52
+ "./array_index.js": "./src/array_index.js",
53
+ "./array_max.js": "./src/array_max.js",
54
+ "./array_min.js": "./src/array_min.js",
55
+ "./array_permutations.js": "./src/array_permutations.js",
56
+ "./array_shuffle.js": "./src/array_shuffle.js",
57
+ "./array_sort.js": "./src/array_sort.js",
58
+ "./array_sort_other.js": "./src/array_sort_other.js",
59
+ "./array_sum.js": "./src/array_sum.js",
60
+ "./array_unique.js": "./src/array_unique.js",
61
+ "./array_unique_last.js": "./src/array_unique_last.js",
62
+ "./date_add_months.js": "./src/date_add_months.js",
63
+ "./date_is_leap_year.js": "./src/date_is_leap_year.js",
64
+ "./format_bytes.js": "./src/format_bytes.js",
65
+ "./format_date.js": "./src/format_date.js",
66
+ "./format_date_ymd.js": "./src/format_date_ymd.js",
67
+ "./format_error_report.js": "./src/format_error_report.js",
68
+ "./format_hrtime.js": "./src/format_hrtime.js",
69
+ "./format_kilo.js": "./src/format_kilo.js",
70
+ "./format_ms.js": "./src/format_ms.js",
71
+ "./format_ms2.js": "./src/format_ms2.js",
72
+ "./format_ms3.js": "./src/format_ms3.js",
73
+ "./format_percents.js": "./src/format_percents.js",
74
+ "./format_progress_bytes.js": "./src/format_progress_bytes.js",
75
+ "./format_progress_kilo.js": "./src/format_progress_kilo.js",
76
+ "./format_seconds.js": "./src/format_seconds.js",
77
+ "./format_thousands.js": "./src/format_thousands.js",
78
+ "./http_delete.js": "./src/http_delete.js",
79
+ "./http_get_blob.js": "./src/http_get_blob.js",
80
+ "./http_get_buffer.js": "./src/http_get_buffer.js",
81
+ "./http_get_json.js": "./src/http_get_json.js",
82
+ "./http_get_utf8.js": "./src/http_get_utf8.js",
83
+ "./http_head.js": "./src/http_head.js",
84
+ "./http_patch_json.js": "./src/http_patch_json.js",
85
+ "./http_post_json.js": "./src/http_post_json.js",
86
+ "./http_post_multipart.js": "./src/http_post_multipart.js",
87
+ "./http_put_buffer.js": "./src/http_put_buffer.js",
88
+ "./http_put_json.js": "./src/http_put_json.js",
89
+ "./http_put_utf8.js": "./src/http_put_utf8.js",
90
+ "./identity.js": "./src/identity.js",
91
+ "./ignore.js": "./src/ignore.js",
92
+ "./plural.js": "./src/plural.js",
93
+ "./random_int.js": "./src/random_int.js",
94
+ "./urlmod.js": "./src/urlmod.js",
95
+ "./waitcb.js": "./src/waitcb.js"
96
+ };
97
+
98
+
99
+ function webpackContext(req) {
100
+ var id = webpackContextResolve(req);
101
+ return __webpack_require__(id);
102
+ }
103
+ function webpackContextResolve(req) {
104
+ if(!__webpack_require__.o(map, req)) {
105
+ var e = new Error("Cannot find module '" + req + "'");
106
+ e.code = 'MODULE_NOT_FOUND';
107
+ throw e;
108
+ }
109
+ return map[req];
110
+ }
111
+ webpackContext.keys = function webpackContextKeys() {
112
+ return Object.keys(map);
113
+ };
114
+ webpackContext.resolve = webpackContextResolve;
115
+ module.exports = webpackContext;
116
+ webpackContext.id = "./src sync recursive \\b(array%7Cdate%7Chttp_delete%7Chttp_get_blob%7Chttp_get_buffer%7Chttp_get_json%7Chttp_get_utf8%7Chttp_head%7Chttp_patch_json%7Chttp_post_json%7Chttp_post_multipart%7Chttp_put_buffer%7Chttp_put_json%7Chttp_put_utf8%7Cidentity%7Cignore%7Cformat%7Cplural%7Crandom_int%7Curlmod%7Cwaitcb)[^/]*(?<%21\\.test)\\.js$";
117
+
118
+ /***/ }),
119
+
120
+ /***/ "./src/array_chunk.js":
121
+ /*!****************************!*\
122
+ !*** ./src/array_chunk.js ***!
123
+ \****************************/
124
+ /***/ ((module) => {
125
+
126
+ /**
127
+ * Split an array into chunks.
128
+ *
129
+ * @param array
130
+ * @param limit
131
+ * @returns {*[]}
132
+ */
133
+ function array_chunk(array = [], limit = 1)
134
+ {
135
+ if (limit < 1) {
136
+ throw new Error('Limit value should be greater than 1');
137
+ }
138
+
139
+ const out = [];
140
+ for (let i = 0, end = array.length; i < end; i += limit) {
141
+ out.push(array.slice(i, i + limit));
142
+ }
143
+ return out;
144
+ }
145
+
146
+ module.exports = array_chunk;
147
+
148
+
149
+ /***/ }),
150
+
151
+ /***/ "./src/array_gcd.js":
152
+ /*!**************************!*\
153
+ !*** ./src/array_gcd.js ***!
154
+ \**************************/
155
+ /***/ ((module) => {
156
+
157
+ // https://stackoverflow.com/a/39764792/1478566
158
+ function array_gcd(array, fn = Number)
159
+ {
160
+ return array.reduce((a,b) => gcd(fn(a), fn(b)));
161
+ }
162
+
163
+ // https://stackoverflow.com/a/39764792/1478566
164
+ function gcd(a, b)
165
+ {
166
+ if (b) {
167
+ return gcd(b, a % b);
168
+ }
169
+ return a;
170
+ }
171
+
172
+ module.exports = array_gcd;
173
+
174
+
175
+ /***/ }),
176
+
177
+ /***/ "./src/array_group.js":
178
+ /*!****************************!*\
179
+ !*** ./src/array_group.js ***!
180
+ \****************************/
181
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
182
+
183
+ const array_group_map = __webpack_require__(/*! ./array_group_map */ "./src/array_group_map.js");
184
+
185
+ /**
186
+ * Group items by common key and return an array of groups.
187
+ *
188
+ * @param array
189
+ * @param fn
190
+ * @returns {unknown[]}
191
+ */
192
+ function array_group(array, fn)
193
+ {
194
+ return Object.values(array_group_map(array, fn));
195
+ }
196
+
197
+ module.exports = array_group;
198
+
199
+
200
+ /***/ }),
201
+
202
+ /***/ "./src/array_group_map.js":
203
+ /*!********************************!*\
204
+ !*** ./src/array_group_map.js ***!
205
+ \********************************/
206
+ /***/ ((module) => {
207
+
208
+ /**
209
+ * Group items by common key and return an object of items grouped by key.
210
+ *
211
+ * @param array
212
+ * @param fn
213
+ * @returns {{}}
214
+ */
215
+ function array_group_map(array, fn)
216
+ {
217
+ const out = {};
218
+ array.forEach(function (item) {
219
+ const key = fn(item);
220
+ out[key] = out[key] || {key, items: []};
221
+ out[key].items.push(item);
222
+ });
223
+ return out;
224
+ }
225
+
226
+ module.exports = array_group_map;
227
+
228
+
229
+ /***/ }),
230
+
231
+ /***/ "./src/array_index.js":
232
+ /*!****************************!*\
233
+ !*** ./src/array_index.js ***!
234
+ \****************************/
235
+ /***/ ((module) => {
236
+
237
+ /**
238
+ * Usage:
239
+ * array_index(items, v => v.name)
240
+ *
241
+ * Seems, there is a native way to do it:
242
+ * Object.fromEntries(items.map(v => [v.name, v]));
243
+ */
244
+ function array_index(array, fn)
245
+ {
246
+ const out = {};
247
+ array.forEach(v => out[fn(v)] = v);
248
+ return out;
249
+ }
250
+
251
+ module.exports = array_index;
252
+
253
+
254
+ /***/ }),
255
+
256
+ /***/ "./src/array_max.js":
257
+ /*!**************************!*\
258
+ !*** ./src/array_max.js ***!
259
+ \**************************/
260
+ /***/ ((module) => {
261
+
262
+ /**
263
+ * Return first among maximum values.
264
+ *
265
+ * @param array
266
+ * @param fn
267
+ */
268
+ function array_max(array, fn = identity)
269
+ {
270
+ let out = null;
271
+ let out_value = null;
272
+ array.forEach(function (item) {
273
+ const item_value = fn(item);
274
+ if (item_value > out_value || out_value === null) {
275
+ out = item;
276
+ out_value = item_value;
277
+ }
278
+ });
279
+ return out;
280
+ }
281
+
282
+ function identity(value)
283
+ {
284
+ return value;
285
+ }
286
+
287
+ module.exports = array_max;
288
+
289
+
290
+ /***/ }),
291
+
292
+ /***/ "./src/array_min.js":
293
+ /*!**************************!*\
294
+ !*** ./src/array_min.js ***!
295
+ \**************************/
296
+ /***/ ((module) => {
297
+
298
+ /**
299
+ * Return first among minimum values.
300
+ *
301
+ * @param array
302
+ * @param fn
303
+ */
304
+ function array_min(array, fn = identity)
305
+ {
306
+ let out = null;
307
+ let out_value = null;
308
+ array.forEach(function (item) {
309
+ const item_value = fn(item);
310
+ if (item_value < out_value || out_value === null) {
311
+ out = item;
312
+ out_value = item_value;
313
+ }
314
+ });
315
+ return out;
316
+ }
317
+
318
+ function identity(value)
319
+ {
320
+ return value;
321
+ }
322
+
323
+ module.exports = array_min;
324
+
325
+
326
+ /***/ }),
327
+
328
+ /***/ "./src/array_permutations.js":
329
+ /*!***********************************!*\
330
+ !*** ./src/array_permutations.js ***!
331
+ \***********************************/
332
+ /***/ ((module) => {
333
+
334
+ // https://stackoverflow.com/a/37580979/23502239
335
+ function array_permutations(array)
336
+ {
337
+ var length = array.length,
338
+ out = [array.slice()],
339
+ c = new Array(length).fill(0),
340
+ i = 1, k, p;
341
+
342
+ while (i < length) {
343
+ if (c[i] < i) {
344
+ k = i % 2 && c[i];
345
+ p = array[i];
346
+ array[i] = array[k];
347
+ array[k] = p;
348
+ ++c[i];
349
+ i = 1;
350
+ out.push(array.slice());
351
+ }
352
+ else {
353
+ c[i] = 0;
354
+ ++i;
355
+ }
356
+ }
357
+ return out;
358
+ }
359
+
360
+ module.exports = array_permutations;
361
+
362
+
363
+ /***/ }),
364
+
365
+ /***/ "./src/array_shuffle.js":
366
+ /*!******************************!*\
367
+ !*** ./src/array_shuffle.js ***!
368
+ \******************************/
369
+ /***/ ((module) => {
370
+
371
+ /**
372
+ * Shuffles an array using Durstenfeld shuffle algorithm.
373
+ *
374
+ * Note: This function performs shuffle in-place. In order
375
+ * to get a shuffled copy use call slice before calling, e.g.
376
+ * array_shuffle(items.slice()).
377
+ *
378
+ * @param array
379
+ * @returns array
380
+ * @link https://stackoverflow.com/a/6274381/1478566
381
+ * @link https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
382
+ */
383
+ function array_shuffle(array)
384
+ {
385
+ for (let i = array.length; --i > 0; ) {
386
+ const j = Math.floor(Math.random() * (i + 1));
387
+ const x = array[i];
388
+ array[i] = array[j];
389
+ array[j] = x;
390
+ }
391
+ return array;
392
+ }
393
+
394
+ module.exports = array_shuffle;
395
+
396
+
397
+ /***/ }),
398
+
399
+ /***/ "./src/array_sort.js":
400
+ /*!***************************!*\
401
+ !*** ./src/array_sort.js ***!
402
+ \***************************/
403
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
404
+
405
+ const fcmp_strings = __webpack_require__(/*! ./fcmp_strings */ "./src/fcmp_strings.js");
406
+
407
+ /**
408
+ * Sort items in an `array`.
409
+ *
410
+ * @param array
411
+ * @param fn
412
+ * @param fcmp
413
+ * @returns {*}
414
+ */
415
+ function array_sort(array, fn = identity, fcmp = fcmp_strings)
416
+ {
417
+ return array.sort(function (a, b) {
418
+ return fcmp(fn(a), fn(b));
419
+ });
420
+ }
421
+
422
+ function identity(v)
423
+ {
424
+ return v;
425
+ }
426
+
427
+ module.exports = array_sort;
428
+
429
+
430
+ /***/ }),
431
+
432
+ /***/ "./src/array_sort_other.js":
433
+ /*!*********************************!*\
434
+ !*** ./src/array_sort_other.js ***!
435
+ \*********************************/
436
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
437
+
438
+ const fcmp_strings = __webpack_require__(/*! ./fcmp_strings */ "./src/fcmp_strings.js");
439
+
440
+ /**
441
+ * Sort items in an `array` at the same order as in `other`. Values which
442
+ * are not in the `other` are added to the end of the result defined by `fcmp`.
443
+ *
444
+ * @param array
445
+ * @param fn
446
+ * @param other
447
+ * @param fcmp
448
+ * @returns {*}
449
+ */
450
+ function array_sort_other(array, fn, other, fcmp = fcmp_strings)
451
+ {
452
+ const other_map = {};
453
+ other.forEach((v,i) => other_map[v] = i + 1);
454
+ return array.sort(function (a, b) {
455
+ const ax = other_map[fn(a)];
456
+ const bx = other_map[fn(b)];
457
+ if (ax && bx) {
458
+ return ax - bx;
459
+ }
460
+ if (ax) {
461
+ return -1;
462
+ }
463
+ if (bx) {
464
+ return 1;
465
+ }
466
+ return fcmp(a, b);
467
+ });
468
+ }
469
+
470
+ module.exports = array_sort_other;
471
+
472
+
473
+ /***/ }),
474
+
475
+ /***/ "./src/array_sum.js":
476
+ /*!**************************!*\
477
+ !*** ./src/array_sum.js ***!
478
+ \**************************/
479
+ /***/ ((module) => {
480
+
481
+ function array_sum(array, fn = Number)
482
+ {
483
+ let out = 0;
484
+ array.forEach(function (item) {
485
+ out += fn(item);
486
+ });
487
+ return out;
488
+ }
489
+
490
+ module.exports = array_sum;
491
+
492
+
493
+ /***/ }),
494
+
495
+ /***/ "./src/array_unique.js":
496
+ /*!*****************************!*\
497
+ !*** ./src/array_unique.js ***!
498
+ \*****************************/
499
+ /***/ ((module) => {
500
+
501
+ function array_unique(values)
502
+ {
503
+ const set = new Set();
504
+ return values.filter(function (item) {
505
+ if (set.has(item)) {
506
+ return false;
507
+ }
508
+ set.add(item);
509
+ return true;
510
+ });
511
+ }
512
+
513
+ module.exports = array_unique;
514
+
515
+
516
+ /***/ }),
517
+
518
+ /***/ "./src/array_unique_last.js":
519
+ /*!**********************************!*\
520
+ !*** ./src/array_unique_last.js ***!
521
+ \**********************************/
522
+ /***/ ((module) => {
523
+
524
+ /**
525
+ * Return only unique values. If there are many values - prefer last one.
526
+ *
527
+ * @param array
528
+ * @param fn
529
+ * @returns {*[]}
530
+ */
531
+ function array_unique_last(array, fn = identity)
532
+ {
533
+ const out = [];
534
+ const taken = {};
535
+ for (let i = array.length; --i >= 0; ) {
536
+ const item = array[i];
537
+ const pk = fn(item);
538
+ if (!taken[pk]) {
539
+ taken[pk] = true;
540
+ out.push(item);
541
+ }
542
+ }
543
+ return out.reverse();
544
+ }
545
+
546
+ function identity(value)
547
+ {
548
+ return value;
549
+ }
550
+
551
+ module.exports = array_unique_last;
552
+
553
+
554
+ /***/ }),
555
+
556
+ /***/ "./src/date_add_months.js":
557
+ /*!********************************!*\
558
+ !*** ./src/date_add_months.js ***!
559
+ \********************************/
560
+ /***/ ((module) => {
561
+
562
+ /**
563
+ * @link https://stackoverflow.com/a/7937257
564
+ */
565
+ function date_add_months(d, months)
566
+ {
567
+ if (!months) {
568
+ return d;
569
+ }
570
+
571
+ // https://github.com/briannesbitt/Carbon/blob/f01cfa96468f4c38325f507ab81a4f1d2cd93cfe/src/Carbon/Traits/Units.php#L360C1-L361C1
572
+ // > } elseif (isset($canOverflow, $day) && $canOverflow && $day !== $date?->day) {
573
+ // > $date = $date?->modify('last day of previous month');
574
+ // > }
575
+
576
+ const date0 = d.getDate();
577
+ d.setMonth(d.getMonth() + months);
578
+ if (d.getDate() !== date0) {
579
+ d.setDate(0);
580
+ }
581
+
582
+ return d;
583
+ }
584
+
585
+ module.exports = date_add_months;
586
+
587
+
588
+ /***/ }),
589
+
590
+ /***/ "./src/date_is_leap_year.js":
591
+ /*!**********************************!*\
592
+ !*** ./src/date_is_leap_year.js ***!
593
+ \**********************************/
594
+ /***/ ((module) => {
595
+
596
+ /**
597
+ * @link https://github.com/moment/moment/blob/18aba135ab927ffe7f868ee09276979bed6993a6/src/lib/utils/is-leap-year.js
598
+ * @link https://en.wikipedia.org/wiki/Leap_year
599
+ * > Each leap year has 366 days instead of 365. This extra leap day
600
+ * > occurs in each year that is a multiple of 4, except for years
601
+ * > evenly divisible by 100 but not by 400.
602
+ */
603
+ function date_is_leap_year(d)
604
+ {
605
+ const year = d.getFullYear();
606
+ // return (year % 4 === 0) && !(year % 100 === 0 && year % 400 !== 0);
607
+ return (year % 4 === 0 && year % 100 !== 0) || (year % 400 === 0);
608
+ }
609
+
610
+ module.exports = date_is_leap_year;
611
+
612
+
613
+ /***/ }),
614
+
615
+ /***/ "./src/factorize_ms.js":
616
+ /*!*****************************!*\
617
+ !*** ./src/factorize_ms.js ***!
618
+ \*****************************/
619
+ /***/ ((module) => {
620
+
621
+ function factorize_ms(v)
622
+ {
623
+ const h = Math.floor(v / 3600000);
624
+ const m = Math.floor(v % 3600000 / 60000);
625
+ const s = Math.floor(v % 60000 / 1000);
626
+ const ms = v % 1000;
627
+ return [h, m, s, ms];
628
+ }
629
+
630
+ module.exports = factorize_ms;
631
+
632
+
633
+ /***/ }),
634
+
635
+ /***/ "./src/fcmp_strings.js":
636
+ /*!*****************************!*\
637
+ !*** ./src/fcmp_strings.js ***!
638
+ \*****************************/
639
+ /***/ ((module) => {
640
+
641
+ function fcmp_strings(a, b)
642
+ {
643
+ return String(a).localeCompare(b);
644
+ }
645
+
646
+ module.exports = fcmp_strings;
647
+
648
+
649
+ /***/ }),
650
+
651
+ /***/ "./src/format_bytes.js":
652
+ /*!*****************************!*\
653
+ !*** ./src/format_bytes.js ***!
654
+ \*****************************/
655
+ /***/ ((module) => {
656
+
657
+ /**
658
+ * @link https://stackoverflow.com/a/18650828
659
+ */
660
+ function format_bytes(bytes)
661
+ {
662
+ const sizes = ['B', 'KB', 'MB', 'GB', 'TB', 'PB'];
663
+ if (typeof bytes !== 'number' || Number.isNaN(bytes)) {
664
+ return 'n/a';
665
+ }
666
+ if (!bytes) {
667
+ return '0KB';
668
+ }
669
+ if (bytes < 1024) {
670
+ return '1KB';
671
+ }
672
+ const i = Math.floor(Math.log(bytes) / Math.log(1024));
673
+ return `${(bytes / (1024 ** i)).toFixed(bytes > 1024*1024 ? 2 : 0)}${sizes[i]}`.replace(/\.00/, '.0');
674
+ }
675
+
676
+ module.exports = format_bytes;
677
+
678
+ // https://wiki.ubuntu.com/UnitsPolicy
679
+ // > Applications must use SI standard for base-10 units:
680
+ // >
681
+ // > 1 kB = 1,000 bytes (Note: small k)
682
+ // > 1 MB = 1,000 kB = 1,000,000 bytes
683
+ // > 1 GB = 1,000 MB = 1,000,000 kB = 1,000,000,000 bytes
684
+ // > 1 TB = 1,000 GB = 1,000,000 MB = 1,000,000,000 kB = 1,000,000,000,000 bytes
685
+
686
+
687
+ /***/ }),
688
+
689
+ /***/ "./src/format_date.js":
690
+ /*!****************************!*\
691
+ !*** ./src/format_date.js ***!
692
+ \****************************/
693
+ /***/ ((module) => {
694
+
695
+ function format_date(d)
696
+ {
697
+ return d.getFullYear() + `/0${d.getMonth()+1}/0${d.getDate()} 0${d.getHours()}:0${d.getMinutes()}:0${d.getSeconds()}`.replace(/0(\d\d)/g, '$1');
698
+ }
699
+
700
+ module.exports = format_date;
701
+
702
+
703
+ /***/ }),
704
+
705
+ /***/ "./src/format_date_ymd.js":
706
+ /*!********************************!*\
707
+ !*** ./src/format_date_ymd.js ***!
708
+ \********************************/
709
+ /***/ ((module) => {
710
+
711
+ function format_date_ymd(d)
712
+ {
713
+ return d.getFullYear() + `/0${d.getMonth()+1}/0${d.getDate()}`.replace(/0(\d\d)/g, '$1');
714
+ }
715
+
716
+ module.exports = format_date_ymd;
717
+
718
+
719
+ /***/ }),
720
+
721
+ /***/ "./src/format_error_report.js":
722
+ /*!************************************!*\
723
+ !*** ./src/format_error_report.js ***!
724
+ \************************************/
725
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
726
+
727
+ const json_stringify_safe = __webpack_require__(/*! ./json_stringify_safe */ "./src/json_stringify_safe.js");
728
+
729
+ function format_error_report(error)
730
+ {
731
+ if (!error) {
732
+ return json_stringify_safe({error: error === undefined ? '---undefined---' : error});
733
+ }
734
+
735
+ if (error.response?.status && error.response?.statusText && error.response?.config) {
736
+ return fm_axios_response(error);
737
+ }
738
+
739
+ if (error.config) {
740
+ return fm_axios_config(error);
741
+ }
742
+
743
+ return json_stringify_safe({
744
+ code: error.code,
745
+ name: error.name,
746
+ message: error.message ?? 'n/a',
747
+ stack: error.stack && error.stack.split(/\n\s*/)
748
+ }, null, 4);
749
+ }
750
+
751
+ function fm_axios_response(error)
752
+ {
753
+ return `
754
+ ${error.message ?? 'n/a'}
755
+
756
+ --- REQUEST ---
757
+
758
+ ${(error.response.config.method||'').toUpperCase()} ${error.response.config.url}
759
+
760
+ ${JSON.stringify(error.response.config.headers||{}, null, 4).slice(1, -1).replace(/^\s+|,$/mg, '').trim()}
761
+
762
+ --- RESPONSE ---
763
+
764
+ ${error.response.status} ${error.response.statusText}
765
+
766
+ ${(error.response.data.toString()||'').slice(0, 10240) || 'n/a'}
767
+
768
+ --- STACK ---
769
+
770
+ ${error.stack ? error.stack.split(/\\n\\s*/) : 'n/a'}
771
+ `.trimStart();
772
+ }
773
+
774
+ function fm_axios_config(error)
775
+ {
776
+ return `
777
+ ${error.message ?? 'n/a'}
778
+
779
+ --- REQUEST ---
780
+
781
+ ${(error.config.method||'').toUpperCase()} ${error.config.url}
782
+
783
+ ${JSON.stringify(error.config.headers||{}, null, 4).slice(1, -1).replace(/^\s+|,$/mg, '').trim()}
784
+
785
+ --- STACK ---
786
+
787
+ ${error.stack ? error.stack.split(/\\n\\s*/) : 'n/a'}
788
+ `.trimStart();
789
+ }
790
+
791
+ module.exports = format_error_report;
792
+
793
+
794
+ /***/ }),
795
+
796
+ /***/ "./src/format_hrtime.js":
797
+ /*!******************************!*\
798
+ !*** ./src/format_hrtime.js ***!
799
+ \******************************/
800
+ /***/ ((module) => {
801
+
802
+ /**
803
+ * Return a human-readable representation of hrtime (the return value from `process.hrtime(hrtime0)`).
804
+ */
805
+ function format_hrtime(hrtime, digits = 6)
806
+ {
807
+ const [u, v] = hrtime; // process.hrtime(hrtime0)
808
+ return (u + v/1E9).toFixed(digits) + 's';
809
+ }
810
+
811
+ module.exports = format_hrtime;
812
+
813
+
814
+ /***/ }),
815
+
816
+ /***/ "./src/format_kilo.js":
817
+ /*!****************************!*\
818
+ !*** ./src/format_kilo.js ***!
819
+ \****************************/
820
+ /***/ ((module) => {
821
+
822
+ function format_kilo(num)
823
+ {
824
+ const sizes = ['', 'K', 'M', 'G', 'T', 'P'];
825
+ if (typeof num !== 'number' || Number.isNaN(num)) {
826
+ return 'n/a';
827
+ }
828
+ if (!num) {
829
+ return '0';
830
+ }
831
+ if (num < 1000) {
832
+ return num.toFixed(0);
833
+ }
834
+ const i = parseInt(Math.floor(Math.log(num) / Math.log(1000)), 10);
835
+ return `${(num / (1000 ** i)).toFixed(2)}${sizes[i]}`;
836
+ }
837
+
838
+ module.exports = format_kilo;
839
+
840
+
841
+ /***/ }),
842
+
843
+ /***/ "./src/format_ms.js":
844
+ /*!**************************!*\
845
+ !*** ./src/format_ms.js ***!
846
+ \**************************/
847
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
848
+
849
+ const factorize_ms = __webpack_require__(/*! ./factorize_ms */ "./src/factorize_ms.js");
850
+
851
+ /**
852
+ * Format milliseconds
853
+ */
854
+ function format_ms(ms)
855
+ {
856
+ if (!ms) {
857
+ ms = 0;
858
+ }
859
+
860
+ // 00:05
861
+ const [h, m, s] = factorize_ms(ms);
862
+ if (h) {
863
+ return `0${h}:0${m}:0${s}`.replace(/0+(?=\d\d)/g, '');
864
+ }
865
+ return `0${m}:0${s}`.replace(/0+(?=\d\d)/g, '');
866
+ }
867
+
868
+ module.exports = format_ms;
869
+
870
+
871
+ /***/ }),
872
+
873
+ /***/ "./src/format_ms2.js":
874
+ /*!***************************!*\
875
+ !*** ./src/format_ms2.js ***!
876
+ \***************************/
877
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
878
+
879
+ const factorize_ms = __webpack_require__(/*! ./factorize_ms */ "./src/factorize_ms.js");
880
+
881
+ /**
882
+ * Format milliseconds
883
+ */
884
+ function format_ms2(ms)
885
+ {
886
+ if (!ms) {
887
+ ms = 0;
888
+ }
889
+
890
+ // 00:05.45
891
+ const [h, m, s, xx] = factorize_ms(ms);
892
+ if (h) {
893
+ return `0${h}:0${m}:0${s}.0${Math.round(xx/10)}`.replace(/0+(?=\d\d)/g, '');
894
+ }
895
+ return `0${m}:0${s}.0${Math.round(xx/10)}`.replace(/0+(?=\d\d)/g, '');
896
+ }
897
+
898
+ module.exports = format_ms2;
899
+
900
+
901
+ /***/ }),
902
+
903
+ /***/ "./src/format_ms3.js":
904
+ /*!***************************!*\
905
+ !*** ./src/format_ms3.js ***!
906
+ \***************************/
907
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
908
+
909
+ const factorize_ms = __webpack_require__(/*! ./factorize_ms */ "./src/factorize_ms.js");
910
+
911
+ /**
912
+ * Format milliseconds
913
+ */
914
+ function format_ms3(ms)
915
+ {
916
+ if (!ms) {
917
+ ms = 0;
918
+ }
919
+
920
+ // 00:05.445
921
+ const [h, m, s, xx] = factorize_ms(ms);
922
+ if (h) {
923
+ return `0${h}:0${m}:0${s}.00${xx}`.replace(/0+(?=\d\d+[:.]|\d\d\d)/g, '');
924
+ }
925
+ return `0${m}:0${s}.00${xx}`.replace(/0+(?=\d\d+[:.]|\d\d\d)/g, '')
926
+ }
927
+
928
+ module.exports = format_ms3;
929
+
930
+
931
+ /***/ }),
932
+
933
+ /***/ "./src/format_percents.js":
934
+ /*!********************************!*\
935
+ !*** ./src/format_percents.js ***!
936
+ \********************************/
937
+ /***/ ((module) => {
938
+
939
+ function format_percents(v)
940
+ {
941
+ return (v*100).toFixed(2).replace(/^(0|100).00$/, '$1') + '%';
942
+ }
943
+
944
+ module.exports = format_percents;
945
+
946
+
947
+ /***/ }),
948
+
949
+ /***/ "./src/format_progress_bytes.js":
950
+ /*!**************************************!*\
951
+ !*** ./src/format_progress_bytes.js ***!
952
+ \**************************************/
953
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
954
+
955
+ const format_bytes = __webpack_require__(/*! ./format_bytes */ "./src/format_bytes.js");
956
+ const format_percents = __webpack_require__(/*! ./format_percents */ "./src/format_percents.js");
957
+ const format_seconds = __webpack_require__(/*! ./format_seconds */ "./src/format_seconds.js");
958
+ const is_number_gt = __webpack_require__(/*! ./is_number_gt */ "./src/is_number_gt.js");
959
+
960
+ function format_progress_bytes({percents, total, done, rate, eta, duration})
961
+ {
962
+ const bps = is_number_gt(rate, 0) ? `${format_bytes(rate)}/s` : '~';
963
+ if (done > total) {
964
+ return `${format_bytes(done)} at ${bps} duration=${format_seconds(duration)}`;
965
+ }
966
+ if (is_number_gt(total, 0)) {
967
+ const eta_str = is_number_gt(eta, 0) ? format_seconds(eta) : '~';
968
+ return `${format_percents(percents)} | ${format_bytes(done)} of ${format_bytes(total)} at ${bps} ETA ${eta_str} duration=${format_seconds(duration)}`;
969
+ }
970
+ if (is_number_gt(done, 0)) {
971
+ return `${format_bytes(done)} of ~ at ${bps} duration=${format_seconds(duration)}`;
972
+ }
973
+ if (is_number_gt(duration, 0)) {
974
+ return `~ duration=${format_seconds(duration)}`;
975
+ }
976
+ return '~';
977
+ }
978
+
979
+ module.exports = format_progress_bytes;
980
+
981
+
982
+ /***/ }),
983
+
984
+ /***/ "./src/format_progress_kilo.js":
985
+ /*!*************************************!*\
986
+ !*** ./src/format_progress_kilo.js ***!
987
+ \*************************************/
988
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
989
+
990
+ const format_kilo = __webpack_require__(/*! ./format_kilo */ "./src/format_kilo.js");
991
+ const format_percents = __webpack_require__(/*! ./format_percents */ "./src/format_percents.js");
992
+ const format_seconds = __webpack_require__(/*! ./format_seconds */ "./src/format_seconds.js");
993
+ const is_number_gt = __webpack_require__(/*! ./is_number_gt */ "./src/is_number_gt.js");
994
+
995
+ function format_progress_kilo({percents, total, done, rate, eta, duration})
996
+ {
997
+ const speed = is_number_gt(rate, 0) ? `${format_kilo(rate)}/s` : '~';
998
+ if (done > total) {
999
+ return `${format_kilo(done)} at ${speed} duration=${format_seconds(duration)}`;
1000
+ }
1001
+ if (is_number_gt(total, 0)) {
1002
+ const eta_str = is_number_gt(eta, 0) ? format_seconds(eta) : '~';
1003
+ return `${format_percents(percents)} | ${format_kilo(done)} of ${format_kilo(total)} at ${speed} ETA ${eta_str} duration=${format_seconds(duration)}`;
1004
+ }
1005
+ if (is_number_gt(done, 0)) {
1006
+ return `${format_kilo(done)} of ~ at ${speed} duration=${format_seconds(duration)}`;
1007
+ }
1008
+ if (is_number_gt(duration, 0)) {
1009
+ return `~ duration=${format_seconds(duration)}`;
1010
+ }
1011
+ return '~';
1012
+ }
1013
+
1014
+ module.exports = format_progress_kilo;
1015
+
1016
+
1017
+ /***/ }),
1018
+
1019
+ /***/ "./src/format_seconds.js":
1020
+ /*!*******************************!*\
1021
+ !*** ./src/format_seconds.js ***!
1022
+ \*******************************/
1023
+ /***/ ((module) => {
1024
+
1025
+ function format_seconds(seconds)
1026
+ {
1027
+ const v = Math.abs(Math.trunc(seconds));
1028
+ const hh = Math.floor(v / 60 / 60);
1029
+ const mm = Math.floor(v / 60) % 60;
1030
+ const ss = v % 60;
1031
+ const tmp = `0${hh}:0${mm}:0${ss}`.replace(/0(\d\d)/g, '$1');
1032
+ return (seconds <= -1) ? ('-' + tmp) : tmp;
1033
+ }
1034
+
1035
+ module.exports = format_seconds;
1036
+
1037
+
1038
+ /***/ }),
1039
+
1040
+ /***/ "./src/format_thousands.js":
1041
+ /*!*********************************!*\
1042
+ !*** ./src/format_thousands.js ***!
1043
+ \*********************************/
1044
+ /***/ ((module) => {
1045
+
1046
+ // https://stackoverflow.com/a/2901298
1047
+ function format_thousands(x)
1048
+ {
1049
+ return x.toString().replace(/\B(?<!\.\d*)(?=(\d{3})+(?!\d))/g, ',');
1050
+ }
1051
+
1052
+ module.exports = format_thousands;
1053
+
1054
+
1055
+ /***/ }),
1056
+
1057
+ /***/ "./src/http_delete.js":
1058
+ /*!****************************!*\
1059
+ !*** ./src/http_delete.js ***!
1060
+ \****************************/
1061
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1062
+
1063
+ const axios = __webpack_require__(/*! axios */ "axios");
1064
+
1065
+ function http_delete(url, options)
1066
+ {
1067
+ return axios.delete(url, {responseType: 'json', ...options}).then(v => v.data);
1068
+ }
1069
+
1070
+ module.exports = http_delete;
1071
+
1072
+
1073
+ /***/ }),
1074
+
1075
+ /***/ "./src/http_get_blob.js":
1076
+ /*!******************************!*\
1077
+ !*** ./src/http_get_blob.js ***!
1078
+ \******************************/
1079
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1080
+
1081
+ const axios = __webpack_require__(/*! axios */ "axios");
1082
+
1083
+ function http_get_blob(url, options)
1084
+ {
1085
+ return axios.get(url, {responseType: 'blob', ...options}).then(v => v.data);
1086
+ }
1087
+
1088
+ module.exports = http_get_blob;
1089
+
1090
+
1091
+ /***/ }),
1092
+
1093
+ /***/ "./src/http_get_buffer.js":
1094
+ /*!********************************!*\
1095
+ !*** ./src/http_get_buffer.js ***!
1096
+ \********************************/
1097
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1098
+
1099
+ const axios = __webpack_require__(/*! axios */ "axios");
1100
+
1101
+ function http_get_buffer(url, options)
1102
+ {
1103
+ return axios.get(url, {responseType: 'arraybuffer', ...options}).then(v => v.data);
1104
+ }
1105
+
1106
+ module.exports = http_get_buffer;
1107
+
1108
+
1109
+ /***/ }),
1110
+
1111
+ /***/ "./src/http_get_json.js":
1112
+ /*!******************************!*\
1113
+ !*** ./src/http_get_json.js ***!
1114
+ \******************************/
1115
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1116
+
1117
+ const axios = __webpack_require__(/*! axios */ "axios");
1118
+
1119
+ function http_get_json(url, options)
1120
+ {
1121
+ return axios.get(url, {responseType: 'json', ...options}).then(v => v.data);
1122
+ }
1123
+
1124
+ module.exports = http_get_json;
1125
+
1126
+
1127
+ /***/ }),
1128
+
1129
+ /***/ "./src/http_get_utf8.js":
1130
+ /*!******************************!*\
1131
+ !*** ./src/http_get_utf8.js ***!
1132
+ \******************************/
1133
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1134
+
1135
+ const axios = __webpack_require__(/*! axios */ "axios");
1136
+
1137
+ function http_get_utf8(url, options)
1138
+ {
1139
+ return axios.get(url, {responseType: 'text', responseEncoding: 'utf8', ...options}).then(v => v.data);
1140
+ }
1141
+
1142
+ module.exports = http_get_utf8;
1143
+
1144
+
1145
+ /***/ }),
1146
+
1147
+ /***/ "./src/http_head.js":
1148
+ /*!**************************!*\
1149
+ !*** ./src/http_head.js ***!
1150
+ \**************************/
1151
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1152
+
1153
+ const axios = __webpack_require__(/*! axios */ "axios");
1154
+
1155
+ function http_head(url, options)
1156
+ {
1157
+ return axios.head(url, options).then(v => v.request.res.headers);
1158
+ }
1159
+
1160
+ module.exports = http_head;
1161
+
1162
+
1163
+ /***/ }),
1164
+
1165
+ /***/ "./src/http_patch_json.js":
1166
+ /*!********************************!*\
1167
+ !*** ./src/http_patch_json.js ***!
1168
+ \********************************/
1169
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1170
+
1171
+ const axios = __webpack_require__(/*! axios */ "axios");
1172
+
1173
+ function http_patch_json(url, body, options)
1174
+ {
1175
+ return axios.patch(url, body, options).then(v => v.data);
1176
+ }
1177
+
1178
+ module.exports = http_patch_json;
1179
+
1180
+
1181
+ /***/ }),
1182
+
1183
+ /***/ "./src/http_post_json.js":
1184
+ /*!*******************************!*\
1185
+ !*** ./src/http_post_json.js ***!
1186
+ \*******************************/
1187
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1188
+
1189
+ const axios = __webpack_require__(/*! axios */ "axios");
1190
+
1191
+ function http_post_json(url, body, options)
1192
+ {
1193
+ return axios.post(url, body, options).then(v => v.data);
1194
+ }
1195
+
1196
+ module.exports = http_post_json;
1197
+
1198
+
1199
+ /***/ }),
1200
+
1201
+ /***/ "./src/http_post_multipart.js":
1202
+ /*!************************************!*\
1203
+ !*** ./src/http_post_multipart.js ***!
1204
+ \************************************/
1205
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1206
+
1207
+ const FormData = __webpack_require__(/*! form-data */ "form-data");
1208
+ const axios = __webpack_require__(/*! axios */ "axios");
1209
+
1210
+ // Provide examples for the following common tasks:
1211
+ //
1212
+ // * send plain text
1213
+ // * send json
1214
+ // * send image
1215
+ // * send attachment
1216
+
1217
+ // import fetch from 'node-fetch';
1218
+ //
1219
+ // async function http_post_multipart(url, rows)
1220
+ // {
1221
+ // const form = new FormData();
1222
+ // for (let i = 0, end = rows.length; i < end; ++i) {
1223
+ // const {name, body} = rows[i];
1224
+ // form.append(name, body);
1225
+ // }
1226
+ // return await fetch(url, {method: 'POST', body: form});
1227
+ // }
1228
+ //
1229
+ // Example:
1230
+ //
1231
+ // const rows = [];
1232
+ // rows.push({name: 'from', body: MAILGUN_FROM});
1233
+ // rows.push({name: 'to', body: to});
1234
+ // rows.push({name: 'subject', body: subject});
1235
+ // rows.push({name: 'text', body: text});
1236
+ // rows.push({name: 'attachment', body: fs_read_stream(__filename), options: {filename: 'hello.txt'}});
1237
+ // return http_post_multipart(`${MAILGUN_BASE}/messages`, rows, options);
1238
+
1239
+ // https://github.com/axios/axios/issues/318#issuecomment-344620216
1240
+ // https://github.com/axios/axios/issues/1006#issuecomment-320165427
1241
+ function http_post_multipart(url, items, options)
1242
+ {
1243
+ const form = new FormData();
1244
+ for (let i = 0, end = items.length; i < end; ++i) {
1245
+ const item = items[i];
1246
+ // Without this, all string vales (ordinary fields) will
1247
+ // be empty in _Chrome 59.0.3071.86 (Official Build) (64-bit)_
1248
+ if (item.options) {
1249
+ form.append(item.name, item.body, item.options);
1250
+ }
1251
+ else {
1252
+ form.append(item.name, item.body);
1253
+ }
1254
+ }
1255
+ // For Node
1256
+ // import FormData from 'form-data'
1257
+ // noinspection JSUnresolvedVariable
1258
+ if (form.getHeaders) {
1259
+ const options2 = {...options};
1260
+ options2.headers = {...options2.headers, ...form.getHeaders()};
1261
+ return Promise.resolve(axios.post(url, form, options2)).then(v => v.data);
1262
+ }
1263
+ // For Browser
1264
+ // webpack.config.js
1265
+ // externals: {"form-data": "FormData"}
1266
+ return Promise.resolve(axios.post(url, form, options)).then(v => v.data);
1267
+ }
1268
+
1269
+ module.exports = http_post_multipart;
1270
+
1271
+
1272
+ /***/ }),
1273
+
1274
+ /***/ "./src/http_put_buffer.js":
1275
+ /*!********************************!*\
1276
+ !*** ./src/http_put_buffer.js ***!
1277
+ \********************************/
1278
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1279
+
1280
+ const axios = __webpack_require__(/*! axios */ "axios");
1281
+
1282
+ function http_put_buffer(url, body, options)
1283
+ {
1284
+ return axios.put(url, body, options).then(v => v.data);
1285
+ }
1286
+
1287
+ module.exports = http_put_buffer;
1288
+
1289
+
1290
+ /***/ }),
1291
+
1292
+ /***/ "./src/http_put_json.js":
1293
+ /*!******************************!*\
1294
+ !*** ./src/http_put_json.js ***!
1295
+ \******************************/
1296
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1297
+
1298
+ const axios = __webpack_require__(/*! axios */ "axios");
1299
+
1300
+ function http_put_json(url, body, options)
1301
+ {
1302
+ return axios.put(url, body, options).then(v => v.data);
1303
+ }
1304
+
1305
+ module.exports = http_put_json;
1306
+
1307
+
1308
+ /***/ }),
1309
+
1310
+ /***/ "./src/http_put_utf8.js":
1311
+ /*!******************************!*\
1312
+ !*** ./src/http_put_utf8.js ***!
1313
+ \******************************/
1314
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1315
+
1316
+ const axios = __webpack_require__(/*! axios */ "axios");
1317
+
1318
+ async function http_put_utf8(url, utf8, options)
1319
+ {
1320
+ return axios.put(url, utf8, options).then(v => v.data);
1321
+ }
1322
+
1323
+ module.exports = http_put_utf8;
1324
+
1325
+
1326
+ /***/ }),
1327
+
1328
+ /***/ "./src/identity.js":
1329
+ /*!*************************!*\
1330
+ !*** ./src/identity.js ***!
1331
+ \*************************/
1332
+ /***/ ((module) => {
1333
+
1334
+ function identity(value)
1335
+ {
1336
+ return value;
1337
+ }
1338
+
1339
+ module.exports = identity;
1340
+
1341
+
1342
+ /***/ }),
1343
+
1344
+ /***/ "./src/ignore.js":
1345
+ /*!***********************!*\
1346
+ !*** ./src/ignore.js ***!
1347
+ \***********************/
1348
+ /***/ ((module) => {
1349
+
1350
+ function ignore()
1351
+ {
1352
+ }
1353
+
1354
+ module.exports = ignore;
1355
+
1356
+
1357
+ /***/ }),
1358
+
1359
+ /***/ "./src/is_number.js":
1360
+ /*!**************************!*\
1361
+ !*** ./src/is_number.js ***!
1362
+ \**************************/
1363
+ /***/ ((module) => {
1364
+
1365
+ function is_number(value)
1366
+ {
1367
+ return (typeof value === 'number') && isFinite(value);
1368
+ }
1369
+
1370
+ module.exports = is_number;
1371
+
1372
+
1373
+ /***/ }),
1374
+
1375
+ /***/ "./src/is_number_gt.js":
1376
+ /*!*****************************!*\
1377
+ !*** ./src/is_number_gt.js ***!
1378
+ \*****************************/
1379
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1380
+
1381
+ const is_number = __webpack_require__(/*! ./is_number */ "./src/is_number.js");
1382
+
1383
+ function is_number_gt(value, min)
1384
+ {
1385
+ return is_number(value) && value > min;
1386
+ }
1387
+
1388
+ module.exports = is_number_gt;
1389
+
1390
+
1391
+ /***/ }),
1392
+
1393
+ /***/ "./src/json_stringify_safe.js":
1394
+ /*!************************************!*\
1395
+ !*** ./src/json_stringify_safe.js ***!
1396
+ \************************************/
1397
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1398
+
1399
+ const json_stringify_safe = __webpack_require__(/*! json-stringify-safe */ "./node_modules/json-stringify-safe/stringify.js");
1400
+
1401
+ module.exports = json_stringify_safe;
1402
+
1403
+
1404
+ /***/ }),
1405
+
1406
+ /***/ "./src/plural.js":
1407
+ /*!***********************!*\
1408
+ !*** ./src/plural.js ***!
1409
+ \***********************/
1410
+ /***/ ((module) => {
1411
+
1412
+ function plural(n, apple, apples)
1413
+ {
1414
+ return (n % 10 === 1 && n % 100 !== 11) ? apple.split('#').join(n) : apples.split('#').join(n);
1415
+ }
1416
+
1417
+ module.exports = plural;
1418
+
1419
+
1420
+ /***/ }),
1421
+
1422
+ /***/ "./src/random_int.js":
1423
+ /*!***************************!*\
1424
+ !*** ./src/random_int.js ***!
1425
+ \***************************/
1426
+ /***/ ((module) => {
1427
+
1428
+ function random_int(min, max)
1429
+ {
1430
+ return Math.floor(Math.random()*(max - min + 1) + min);
1431
+ }
1432
+
1433
+ module.exports = random_int;
1434
+
1435
+
1436
+ /***/ }),
1437
+
1438
+ /***/ "./src/urlmod.js":
1439
+ /*!***********************!*\
1440
+ !*** ./src/urlmod.js ***!
1441
+ \***********************/
1442
+ /***/ ((module) => {
1443
+
1444
+ /**
1445
+ * Set, change, or remove query string parameters.
1446
+ *
1447
+ * urlmod('', {a: 1}) '?a=1' set
1448
+ * urlmod('?a=1', {a: 2}) '?a=2' change
1449
+ * urlmod('?a=1', {a: null}) '' remove
1450
+ */
1451
+ function urlmod(url, params)
1452
+ {
1453
+ const tmp_url = new URL(url||'', 'xxx://___base___/');
1454
+ const tmp_search = tmp_url.searchParams;
1455
+ Object.entries(params || {}).forEach(function ([key, value]) {
1456
+ switch (value) {
1457
+ case null:
1458
+ case undefined:
1459
+ tmp_search.delete(key);
1460
+ break;
1461
+ case true:
1462
+ tmp_search.set(key, 1);
1463
+ break;
1464
+ case false:
1465
+ tmp_search.set(key, 0);
1466
+ break;
1467
+ default:
1468
+ tmp_search.set(key, value);
1469
+ break;
1470
+ }
1471
+ });
1472
+ if (url && url[0] === '/') {
1473
+ return tmp_url.toString().replace(/^xxx:\/\/___base___/, '');
1474
+ }
1475
+ return tmp_url.toString().replace(/^xxx:\/\/___base___\//, '');
1476
+ }
1477
+
1478
+ module.exports = urlmod;
1479
+
1480
+
1481
+ /***/ }),
1482
+
1483
+ /***/ "./src/waitcb.js":
1484
+ /*!***********************!*\
1485
+ !*** ./src/waitcb.js ***!
1486
+ \***********************/
1487
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1488
+
1489
+ const Promise = __webpack_require__(/*! bluebird */ "bluebird");
1490
+
1491
+ /**
1492
+ * Wait for a Node-like function to finish (which will call `callback`
1493
+ * with 2 arguments: `error` and `value`).
1494
+ *
1495
+ * await waitcb(cb => fs.writeFile('a', 'hello\n', cb));
1496
+ */
1497
+ function waitcb(fn)
1498
+ {
1499
+ return new Promise(function (resolve, reject) {
1500
+ fn(function (error, out) {
1501
+ error ? reject(error) : resolve(out);
1502
+ });
1503
+ });
1504
+ }
1505
+
1506
+ module.exports = waitcb;
1507
+
1508
+
1509
+ /***/ }),
1510
+
1511
+ /***/ "axios":
1512
+ /*!************************!*\
1513
+ !*** external "axios" ***!
1514
+ \************************/
1515
+ /***/ ((module) => {
1516
+
1517
+ "use strict";
1518
+ module.exports = axios;
1519
+
1520
+ /***/ }),
1521
+
1522
+ /***/ "bluebird":
1523
+ /*!**************************!*\
1524
+ !*** external "Promise" ***!
1525
+ \**************************/
1526
+ /***/ ((module) => {
1527
+
1528
+ "use strict";
1529
+ module.exports = Promise;
1530
+
1531
+ /***/ }),
1532
+
1533
+ /***/ "form-data":
1534
+ /*!***************************!*\
1535
+ !*** external "FormData" ***!
1536
+ \***************************/
1537
+ /***/ ((module) => {
1538
+
1539
+ "use strict";
1540
+ module.exports = FormData;
1541
+
1542
+ /***/ })
1543
+
1544
+ /******/ });
1545
+ /************************************************************************/
1546
+ /******/ // The module cache
1547
+ /******/ var __webpack_module_cache__ = {};
1548
+ /******/
1549
+ /******/ // The require function
1550
+ /******/ function __webpack_require__(moduleId) {
1551
+ /******/ // Check if module is in cache
1552
+ /******/ var cachedModule = __webpack_module_cache__[moduleId];
1553
+ /******/ if (cachedModule !== undefined) {
1554
+ /******/ return cachedModule.exports;
1555
+ /******/ }
1556
+ /******/ // Create a new module (and put it into the cache)
1557
+ /******/ var module = __webpack_module_cache__[moduleId] = {
1558
+ /******/ // no module.id needed
1559
+ /******/ // no module.loaded needed
1560
+ /******/ exports: {}
1561
+ /******/ };
1562
+ /******/
1563
+ /******/ // Execute the module function
1564
+ /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
1565
+ /******/
1566
+ /******/ // Return the exports of the module
1567
+ /******/ return module.exports;
1568
+ /******/ }
1569
+ /******/
1570
+ /************************************************************************/
1571
+ /******/ /* webpack/runtime/hasOwnProperty shorthand */
1572
+ /******/ (() => {
1573
+ /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
1574
+ /******/ })();
1575
+ /******/
1576
+ /************************************************************************/
1577
+ var __webpack_exports__ = {};
1578
+ // This entry needs to be wrapped in an IIFE because it needs to be isolated against other modules in the chunk.
1579
+ (() => {
1580
+ /*!******************************!*\
1581
+ !*** ./src/browser/index.js ***!
1582
+ \******************************/
1583
+ // https://github.com/webpack/webpack/issues/625
1584
+ // https://webpack.js.org/guides/dependency-management/#require-context
1585
+ const require_tmp = __webpack_require__("./src sync recursive \\b(array%7Cdate%7Chttp_delete%7Chttp_get_blob%7Chttp_get_buffer%7Chttp_get_json%7Chttp_get_utf8%7Chttp_head%7Chttp_patch_json%7Chttp_post_json%7Chttp_post_multipart%7Chttp_put_buffer%7Chttp_put_json%7Chttp_put_utf8%7Cidentity%7Cignore%7Cformat%7Cplural%7Crandom_int%7Curlmod%7Cwaitcb)[^/]*(?<%21\\.test)\\.js$");
1586
+ require_tmp.keys().forEach(function (key) {
1587
+ const [, basename] = key.match(/([^/]+)\.js$/);
1588
+ window[basename] = require_tmp(key);
1589
+ });
1590
+
1591
+ })();
1592
+
1593
+ /******/ })()
1594
+ ;