@ceeblue/web-utils 7.5.0 → 7.6.0
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/dist/web-utils.d.ts +5 -3
- package/dist/web-utils.js +46 -13
- package/dist/web-utils.js.map +1 -1
- package/dist/web-utils.min.js +1 -1
- package/dist/web-utils.min.js.map +1 -1
- package/package.json +1 -1
package/dist/web-utils.d.ts
CHANGED
|
@@ -869,10 +869,12 @@ declare function iterableEntries(value: any): IterableIterator<[string, any]>;
|
|
|
869
869
|
* Converts various data types, such as objects, strings, exceptions, errors,
|
|
870
870
|
* or numbers, into a string representation. Since it offers a more comprehensive format,
|
|
871
871
|
* this function is preferred to `JSON.stringify()`.
|
|
872
|
+
*
|
|
872
873
|
* @param obj Any objects, strings, exceptions, errors, or number
|
|
873
874
|
* @param params.space `''`, allows to configure space in the string representation
|
|
874
875
|
* @param params.decimal `2`, allows to choose the number of decimal to display in the string representation
|
|
875
|
-
* @param params.recursion `
|
|
876
|
+
* @param params.recursion `2`, recursion depth to stringify recursively every object value until this depth,
|
|
877
|
+
* beware if a value refers to a already parsed value an infinite loop will occur
|
|
876
878
|
* @param params.noBin `false`, when set skip binary encoding and write inplace a bin-length information
|
|
877
879
|
* @returns the final string representation
|
|
878
880
|
*/
|
|
@@ -1207,6 +1209,8 @@ declare class PlayerStats extends Loggable {
|
|
|
1207
1209
|
latency?: number;
|
|
1208
1210
|
rtt?: number;
|
|
1209
1211
|
jitter?: number;
|
|
1212
|
+
skippedVideo?: number;
|
|
1213
|
+
skippedAudio?: number;
|
|
1210
1214
|
playbackSpeed?: number;
|
|
1211
1215
|
playbackRate?: number;
|
|
1212
1216
|
recvByteRate?: number;
|
|
@@ -1217,8 +1221,6 @@ declare class PlayerStats extends Loggable {
|
|
|
1217
1221
|
audioTrackBandwidth?: number;
|
|
1218
1222
|
videoPerSecond?: number;
|
|
1219
1223
|
audioPerSecond?: number;
|
|
1220
|
-
skippedVideoCount?: number;
|
|
1221
|
-
skippedAudioCount?: number;
|
|
1222
1224
|
lostPacketCount?: number;
|
|
1223
1225
|
nackCount?: number;
|
|
1224
1226
|
stallCount?: number;
|
package/dist/web-utils.js
CHANGED
|
@@ -295,17 +295,19 @@ function iterableEntries(value) {
|
|
|
295
295
|
* Converts various data types, such as objects, strings, exceptions, errors,
|
|
296
296
|
* or numbers, into a string representation. Since it offers a more comprehensive format,
|
|
297
297
|
* this function is preferred to `JSON.stringify()`.
|
|
298
|
+
*
|
|
298
299
|
* @param obj Any objects, strings, exceptions, errors, or number
|
|
299
300
|
* @param params.space `''`, allows to configure space in the string representation
|
|
300
301
|
* @param params.decimal `2`, allows to choose the number of decimal to display in the string representation
|
|
301
|
-
* @param params.recursion `
|
|
302
|
+
* @param params.recursion `2`, recursion depth to stringify recursively every object value until this depth,
|
|
303
|
+
* beware if a value refers to a already parsed value an infinite loop will occur
|
|
302
304
|
* @param params.noBin `false`, when set skip binary encoding and write inplace a bin-length information
|
|
303
305
|
* @returns the final string representation
|
|
304
306
|
*/
|
|
305
307
|
// Online Javascript Editor for free
|
|
306
308
|
// Write, Edit and Run your Javascript code using JS Online Compiler
|
|
307
309
|
function stringify(obj, params = {}) {
|
|
308
|
-
params = Object.assign({ space: ' ', decimal: 2, recursion:
|
|
310
|
+
params = Object.assign({ space: ' ', decimal: 2, recursion: 2, noBin: false }, params);
|
|
309
311
|
if (obj == null) {
|
|
310
312
|
return String(obj);
|
|
311
313
|
}
|
|
@@ -328,27 +330,58 @@ function stringify(obj, params = {}) {
|
|
|
328
330
|
// boolean or string type or stop recursivity
|
|
329
331
|
if (typeof obj === 'boolean' || obj.substring || !params.recursion) {
|
|
330
332
|
// is already a string OR has to be stringified
|
|
331
|
-
return String(obj);
|
|
333
|
+
return typeof obj === 'object' ? Object.prototype.toString.call(obj) : String(obj);
|
|
334
|
+
}
|
|
335
|
+
const space = params.space;
|
|
336
|
+
if (obj instanceof Set) {
|
|
337
|
+
let res = 'Set[';
|
|
338
|
+
let first = true;
|
|
339
|
+
for (const value of obj.values()) {
|
|
340
|
+
if (!first) {
|
|
341
|
+
res += ',' + space;
|
|
342
|
+
}
|
|
343
|
+
first = false;
|
|
344
|
+
res += stringify(value, Object.assign(Object.assign({}, params), { recursion: params.recursion - 1 }));
|
|
345
|
+
}
|
|
346
|
+
return res + ']';
|
|
347
|
+
}
|
|
348
|
+
if (obj instanceof Map) {
|
|
349
|
+
let res = 'Map{';
|
|
350
|
+
let first = true;
|
|
351
|
+
for (const [k, v] of obj.entries()) {
|
|
352
|
+
if (!first) {
|
|
353
|
+
res += ',' + space;
|
|
354
|
+
}
|
|
355
|
+
first = false;
|
|
356
|
+
res += stringify(k, Object.assign(Object.assign({}, params), { recursion: params.recursion - 1 }));
|
|
357
|
+
res += ':' + stringify(v, Object.assign(Object.assign({}, params), { recursion: params.recursion - 1 }));
|
|
358
|
+
}
|
|
359
|
+
return res + '}';
|
|
332
360
|
}
|
|
333
|
-
const space = params.space || '';
|
|
334
361
|
if (Array.isArray(obj)) {
|
|
335
362
|
// Array!
|
|
336
|
-
let res = '';
|
|
363
|
+
let res = '[';
|
|
364
|
+
let first = true;
|
|
337
365
|
for (const value of obj) {
|
|
338
|
-
|
|
366
|
+
if (!first) {
|
|
367
|
+
res += ',' + space;
|
|
368
|
+
}
|
|
369
|
+
first = false;
|
|
339
370
|
res += stringify(value, Object.assign(Object.assign({}, params), { recursion: params.recursion - 1 }));
|
|
340
371
|
}
|
|
341
|
-
return
|
|
372
|
+
return res + ']';
|
|
342
373
|
}
|
|
343
374
|
let res = '{';
|
|
375
|
+
let first = true;
|
|
344
376
|
for (const name in obj) {
|
|
345
|
-
if (
|
|
346
|
-
res += ',';
|
|
377
|
+
if (!first) {
|
|
378
|
+
res += ',' + space;
|
|
347
379
|
}
|
|
348
|
-
|
|
349
|
-
res +=
|
|
380
|
+
first = false;
|
|
381
|
+
res += name + ':';
|
|
382
|
+
res += stringify(obj[name], Object.assign(Object.assign({}, params), { recursion: params.recursion - 1 }));
|
|
350
383
|
}
|
|
351
|
-
return
|
|
384
|
+
return res + '}';
|
|
352
385
|
}
|
|
353
386
|
/**
|
|
354
387
|
* Encode a string to a binary representation
|
|
@@ -13697,4 +13730,4 @@ class UIMetrics {
|
|
|
13697
13730
|
* This file is part of https://github.com/CeeblueTV/web-utils which is released under GNU Affero General Public License.
|
|
13698
13731
|
* See file LICENSE or go to https://spdx.org/licenses/AGPL-3.0-or-later.html for full license details.
|
|
13699
13732
|
*/
|
|
13700
|
-
const VERSION = '7.
|
|
13733
|
+
const VERSION = '7.6.0';export{BinaryReader,BinaryWriter,BitReader,ByteRate,index as CML,Connect,EpochTime,EventEmitter,FixMap,Log,LogLevel,Loggable,NetAddress,Numbers,PlayerStats,Queue,SDP,UIMetrics,Util,VERSION,WebSocketReliable,log};//# sourceMappingURL=web-utils.js.map
|