lib0 0.2.42 → 0.2.43
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/README.md +78 -72
- package/bin/gendocs.js +1 -1
- package/component.d.ts +4 -1
- package/component.d.ts.map +1 -1
- package/component.js +4 -1
- package/dist/{broadcastchannel-8a61b21a.cjs → broadcastchannel-044f32d2.cjs} +2 -2
- package/dist/{broadcastchannel-8a61b21a.cjs.map → broadcastchannel-044f32d2.cjs.map} +1 -1
- package/dist/broadcastchannel.cjs +3 -3
- package/dist/{buffer-ac2cdedf.cjs → buffer-49880125.cjs} +2 -2
- package/dist/{buffer-ac2cdedf.cjs.map → buffer-49880125.cjs.map} +1 -1
- package/dist/buffer.cjs +2 -2
- package/dist/component.cjs +5 -2
- package/dist/component.cjs.map +1 -1
- package/dist/component.d.ts +4 -1
- package/dist/component.d.ts.map +1 -1
- package/dist/decoding.cjs +2 -2
- package/dist/encoding.cjs +2 -2
- package/dist/{error-55a9a8c8.cjs → error-873c9cbf.cjs} +4 -4
- package/dist/error-873c9cbf.cjs.map +1 -0
- package/dist/error.cjs +1 -1
- package/dist/error.d.ts.map +1 -1
- package/dist/index.cjs +7 -7
- package/dist/{indexeddb-44227700.cjs → indexeddb-5b4b0e13.cjs} +27 -25
- package/dist/indexeddb-5b4b0e13.cjs.map +1 -0
- package/dist/indexeddb.cjs +3 -3
- package/dist/indexeddb.d.ts +2 -2
- package/dist/indexeddb.d.ts.map +1 -1
- package/dist/isomorphic.cjs +2 -6
- package/dist/isomorphic.cjs.map +1 -1
- package/dist/{number-24f1eabe.cjs → number-e62129bc.cjs} +5 -2
- package/dist/number-e62129bc.cjs.map +1 -0
- package/dist/number.cjs +2 -1
- package/dist/number.cjs.map +1 -1
- package/dist/number.d.ts +1 -0
- package/dist/number.d.ts.map +1 -1
- package/dist/{prng-695120cc.cjs → prng-97174619.cjs} +2 -2
- package/dist/{prng-695120cc.cjs.map → prng-97174619.cjs.map} +1 -1
- package/dist/prng.cjs +3 -3
- package/dist/{promise-f0a086b2.cjs → promise-1a9fe712.cjs} +10 -1
- package/dist/{promise-f0a086b2.cjs.map → promise-1a9fe712.cjs.map} +1 -1
- package/dist/promise.cjs +2 -1
- package/dist/promise.cjs.map +1 -1
- package/dist/promise.d.ts +1 -0
- package/dist/promise.d.ts.map +1 -1
- package/dist/string.cjs +1 -3
- package/dist/string.cjs.map +1 -1
- package/dist/test.cjs +30 -25
- package/dist/test.cjs.map +1 -1
- package/dist/test.js +31 -26
- package/dist/test.js.map +1 -1
- package/dist/testing.cjs +8 -5
- package/dist/testing.cjs.map +1 -1
- package/dist/testing.d.ts.map +1 -1
- package/dist/websocket.d.ts +1 -1
- package/dist/websocket.d.ts.map +1 -1
- package/error.d.ts.map +1 -1
- package/error.js +3 -3
- package/indexeddb.d.ts +2 -2
- package/indexeddb.d.ts.map +1 -1
- package/indexeddb.js +25 -23
- package/number.d.ts +1 -0
- package/number.d.ts.map +1 -1
- package/number.js +1 -0
- package/package.json +3 -3
- package/promise.d.ts +1 -0
- package/promise.d.ts.map +1 -1
- package/promise.js +7 -0
- package/testing.d.ts.map +1 -1
- package/testing.js +5 -2
- package/websocket.d.ts +1 -1
- package/websocket.d.ts.map +1 -1
- package/dist/error-55a9a8c8.cjs.map +0 -1
- package/dist/indexeddb-44227700.cjs.map +0 -1
- package/dist/number-24f1eabe.cjs.map +0 -1
package/dist/test.js
CHANGED
|
@@ -551,6 +551,14 @@
|
|
|
551
551
|
/* istanbul ignore next */
|
|
552
552
|
const appendChild = (parent, child) => parent.appendChild(child);
|
|
553
553
|
|
|
554
|
+
doc.ELEMENT_NODE;
|
|
555
|
+
doc.TEXT_NODE;
|
|
556
|
+
doc.CDATA_SECTION_NODE;
|
|
557
|
+
doc.COMMENT_NODE;
|
|
558
|
+
doc.DOCUMENT_NODE;
|
|
559
|
+
doc.DOCUMENT_TYPE_NODE;
|
|
560
|
+
doc.DOCUMENT_FRAGMENT_NODE;
|
|
561
|
+
|
|
554
562
|
/**
|
|
555
563
|
* JSON utility functions.
|
|
556
564
|
*
|
|
@@ -1458,12 +1466,6 @@
|
|
|
1458
1466
|
}
|
|
1459
1467
|
};
|
|
1460
1468
|
|
|
1461
|
-
/**
|
|
1462
|
-
* @todo Remove in favor of simpleDiffString
|
|
1463
|
-
* @deprecated
|
|
1464
|
-
*/
|
|
1465
|
-
const simpleDiff = simpleDiffString;
|
|
1466
|
-
|
|
1467
1469
|
/**
|
|
1468
1470
|
* Create a diff between two arrays. This diff implementation is highly
|
|
1469
1471
|
* efficient, but not very sophisticated.
|
|
@@ -3782,6 +3784,9 @@
|
|
|
3782
3784
|
const times = [];
|
|
3783
3785
|
const start = performance.now();
|
|
3784
3786
|
let lastTime = start;
|
|
3787
|
+
/**
|
|
3788
|
+
* @type {any}
|
|
3789
|
+
*/
|
|
3785
3790
|
let err = null;
|
|
3786
3791
|
performance.mark(`${name}-start`);
|
|
3787
3792
|
do {
|
|
@@ -4002,7 +4007,7 @@
|
|
|
4002
4007
|
*/
|
|
4003
4008
|
const compareStrings = (a, b, m = 'Strings match') => {
|
|
4004
4009
|
if (a !== b) {
|
|
4005
|
-
const diff =
|
|
4010
|
+
const diff = simpleDiffString(a, b);
|
|
4006
4011
|
print(GREY, a.slice(0, diff.index), RED, a.slice(diff.index, diff.remove), GREEN, diff.insert, GREY, a.slice(diff.index + diff.remove));
|
|
4007
4012
|
fail(m);
|
|
4008
4013
|
}
|
|
@@ -5234,22 +5239,22 @@
|
|
|
5234
5239
|
* @module error
|
|
5235
5240
|
*/
|
|
5236
5241
|
|
|
5242
|
+
/* istanbul ignore next */
|
|
5237
5243
|
/**
|
|
5238
5244
|
* @param {string} s
|
|
5239
5245
|
* @return {Error}
|
|
5240
5246
|
*/
|
|
5241
|
-
/* istanbul ignore next */
|
|
5242
5247
|
const create$1 = s => new Error(s);
|
|
5243
5248
|
|
|
5244
5249
|
/* eslint-env browser */
|
|
5245
5250
|
|
|
5251
|
+
/* istanbul ignore next */
|
|
5246
5252
|
/**
|
|
5247
5253
|
* IDB Request to Promise transformer
|
|
5248
5254
|
*
|
|
5249
5255
|
* @param {IDBRequest} request
|
|
5250
5256
|
* @return {Promise<any>}
|
|
5251
5257
|
*/
|
|
5252
|
-
/* istanbul ignore next */
|
|
5253
5258
|
const rtop = request => create$2((resolve, reject) => {
|
|
5254
5259
|
/* istanbul ignore next */
|
|
5255
5260
|
// @ts-ignore
|
|
@@ -5261,12 +5266,12 @@
|
|
|
5261
5266
|
request.onsuccess = event => resolve(event.target.result);
|
|
5262
5267
|
});
|
|
5263
5268
|
|
|
5269
|
+
/* istanbul ignore next */
|
|
5264
5270
|
/**
|
|
5265
5271
|
* @param {string} name
|
|
5266
5272
|
* @param {function(IDBDatabase):any} initDB Called when the database is first created
|
|
5267
5273
|
* @return {Promise<IDBDatabase>}
|
|
5268
5274
|
*/
|
|
5269
|
-
/* istanbul ignore next */
|
|
5270
5275
|
const openDB = (name, initDB) => create$2((resolve, reject) => {
|
|
5271
5276
|
const request = indexedDB.open(name);
|
|
5272
5277
|
/**
|
|
@@ -5298,82 +5303,82 @@
|
|
|
5298
5303
|
};
|
|
5299
5304
|
});
|
|
5300
5305
|
|
|
5306
|
+
/* istanbul ignore next */
|
|
5301
5307
|
/**
|
|
5302
5308
|
* @param {string} name
|
|
5303
5309
|
*/
|
|
5304
|
-
/* istanbul ignore next */
|
|
5305
5310
|
const deleteDB = name => rtop(indexedDB.deleteDatabase(name));
|
|
5306
5311
|
|
|
5312
|
+
/* istanbul ignore next */
|
|
5307
5313
|
/**
|
|
5308
5314
|
* @param {IDBDatabase} db
|
|
5309
5315
|
* @param {Array<Array<string>|Array<string|IDBObjectStoreParameters|undefined>>} definitions
|
|
5310
5316
|
*/
|
|
5311
|
-
/* istanbul ignore next */
|
|
5312
5317
|
const createStores = (db, definitions) => definitions.forEach(d =>
|
|
5313
5318
|
// @ts-ignore
|
|
5314
5319
|
db.createObjectStore.apply(db, d)
|
|
5315
5320
|
);
|
|
5316
5321
|
|
|
5322
|
+
/* istanbul ignore next */
|
|
5317
5323
|
/**
|
|
5318
5324
|
* @param {IDBObjectStore} store
|
|
5319
5325
|
* @param {String | number | ArrayBuffer | Date | Array<any> } key
|
|
5320
5326
|
* @return {Promise<String | number | ArrayBuffer | Date | Array<any>>}
|
|
5321
5327
|
*/
|
|
5322
|
-
/* istanbul ignore next */
|
|
5323
5328
|
const get = (store, key) =>
|
|
5324
5329
|
rtop(store.get(key));
|
|
5325
5330
|
|
|
5331
|
+
/* istanbul ignore next */
|
|
5326
5332
|
/**
|
|
5327
5333
|
* @param {IDBObjectStore} store
|
|
5328
5334
|
* @param {String | number | ArrayBuffer | Date | IDBKeyRange | Array<any> } key
|
|
5329
5335
|
*/
|
|
5330
|
-
/* istanbul ignore next */
|
|
5331
5336
|
const del = (store, key) =>
|
|
5332
5337
|
rtop(store.delete(key));
|
|
5333
5338
|
|
|
5339
|
+
/* istanbul ignore next */
|
|
5334
5340
|
/**
|
|
5335
5341
|
* @param {IDBObjectStore} store
|
|
5336
5342
|
* @param {String | number | ArrayBuffer | Date | boolean} item
|
|
5337
5343
|
* @param {String | number | ArrayBuffer | Date | Array<any>} [key]
|
|
5338
5344
|
*/
|
|
5339
|
-
/* istanbul ignore next */
|
|
5340
5345
|
const put = (store, item, key) =>
|
|
5341
5346
|
rtop(store.put(item, key));
|
|
5342
5347
|
|
|
5348
|
+
/* istanbul ignore next */
|
|
5343
5349
|
/**
|
|
5344
5350
|
* @param {IDBObjectStore} store
|
|
5345
5351
|
* @param {String | number | ArrayBuffer | Date | boolean} item
|
|
5346
5352
|
* @param {String | number | ArrayBuffer | Date | Array<any>} key
|
|
5347
5353
|
* @return {Promise<any>}
|
|
5348
5354
|
*/
|
|
5349
|
-
/* istanbul ignore next */
|
|
5350
5355
|
const add = (store, item, key) =>
|
|
5351
5356
|
rtop(store.add(item, key));
|
|
5352
5357
|
|
|
5358
|
+
/* istanbul ignore next */
|
|
5353
5359
|
/**
|
|
5354
5360
|
* @param {IDBObjectStore} store
|
|
5355
5361
|
* @param {String | number | ArrayBuffer | Date} item
|
|
5356
5362
|
* @return {Promise<number>} Returns the generated key
|
|
5357
5363
|
*/
|
|
5358
|
-
/* istanbul ignore next */
|
|
5359
5364
|
const addAutoKey = (store, item) =>
|
|
5360
5365
|
rtop(store.add(item));
|
|
5361
5366
|
|
|
5367
|
+
/* istanbul ignore next */
|
|
5362
5368
|
/**
|
|
5363
5369
|
* @param {IDBObjectStore} store
|
|
5364
5370
|
* @param {IDBKeyRange} [range]
|
|
5365
5371
|
* @return {Promise<Array<any>>}
|
|
5366
5372
|
*/
|
|
5367
|
-
/* istanbul ignore next */
|
|
5368
5373
|
const getAll = (store, range) =>
|
|
5369
5374
|
rtop(store.getAll(range));
|
|
5370
5375
|
|
|
5376
|
+
/* istanbul ignore next */
|
|
5371
5377
|
/**
|
|
5372
5378
|
* @param {IDBObjectStore} store
|
|
5373
5379
|
* @param {IDBKeyRange} [range]
|
|
5374
5380
|
* @return {Promise<Array<any>>}
|
|
5375
5381
|
*/
|
|
5376
|
-
/* istanbul ignore next */
|
|
5377
5382
|
const getAllKeys = (store, range) =>
|
|
5378
5383
|
rtop(store.getAllKeys(range));
|
|
5379
5384
|
|
|
@@ -5384,22 +5389,22 @@
|
|
|
5384
5389
|
* @property {any} v Value
|
|
5385
5390
|
*/
|
|
5386
5391
|
|
|
5392
|
+
/* istanbul ignore next */
|
|
5387
5393
|
/**
|
|
5388
5394
|
* @param {IDBObjectStore} store
|
|
5389
5395
|
* @param {IDBKeyRange} [range]
|
|
5390
5396
|
* @return {Promise<Array<KeyValuePair>>}
|
|
5391
5397
|
*/
|
|
5392
|
-
/* istanbul ignore next */
|
|
5393
5398
|
const getAllKeysValues = (store, range) =>
|
|
5394
5399
|
// @ts-ignore
|
|
5395
5400
|
all([getAllKeys(store, range), getAll(store, range)]).then(([ks, vs]) => ks.map((k, i) => ({ k, v: vs[i] })));
|
|
5396
5401
|
|
|
5402
|
+
/* istanbul ignore next */
|
|
5397
5403
|
/**
|
|
5398
5404
|
* @param {any} request
|
|
5399
5405
|
* @param {function(IDBCursorWithValue):void|boolean} f
|
|
5400
5406
|
* @return {Promise<void>}
|
|
5401
5407
|
*/
|
|
5402
|
-
/* istanbul ignore next */
|
|
5403
5408
|
const iterateOnRequest = (request, f) => create$2((resolve, reject) => {
|
|
5404
5409
|
/* istanbul ignore next */
|
|
5405
5410
|
request.onerror = reject;
|
|
@@ -5415,6 +5420,7 @@
|
|
|
5415
5420
|
};
|
|
5416
5421
|
});
|
|
5417
5422
|
|
|
5423
|
+
/* istanbul ignore next */
|
|
5418
5424
|
/**
|
|
5419
5425
|
* Iterate on keys and values
|
|
5420
5426
|
* @param {IDBObjectStore} store
|
|
@@ -5422,10 +5428,10 @@
|
|
|
5422
5428
|
* @param {function(any,any):void|boolean} f Callback that receives (value, key)
|
|
5423
5429
|
* @param {'next'|'prev'|'nextunique'|'prevunique'} direction
|
|
5424
5430
|
*/
|
|
5425
|
-
/* istanbul ignore next */
|
|
5426
5431
|
const iterate = (store, keyrange, f, direction = 'next') =>
|
|
5427
5432
|
iterateOnRequest(store.openCursor(keyrange, direction), cursor => f(cursor.value, cursor.key));
|
|
5428
5433
|
|
|
5434
|
+
/* istanbul ignore next */
|
|
5429
5435
|
/**
|
|
5430
5436
|
* Iterate on the keys (no values)
|
|
5431
5437
|
*
|
|
@@ -5434,26 +5440,25 @@
|
|
|
5434
5440
|
* @param {function(any):void|boolean} f callback that receives the key
|
|
5435
5441
|
* @param {'next'|'prev'|'nextunique'|'prevunique'} direction
|
|
5436
5442
|
*/
|
|
5437
|
-
/* istanbul ignore next */
|
|
5438
5443
|
const iterateKeys = (store, keyrange, f, direction = 'next') =>
|
|
5439
5444
|
iterateOnRequest(store.openKeyCursor(keyrange, direction), cursor => f(cursor.key));
|
|
5440
5445
|
|
|
5446
|
+
/* istanbul ignore next */
|
|
5441
5447
|
/**
|
|
5442
5448
|
* Open store from transaction
|
|
5443
5449
|
* @param {IDBTransaction} t
|
|
5444
5450
|
* @param {String} store
|
|
5445
5451
|
* @returns {IDBObjectStore}
|
|
5446
5452
|
*/
|
|
5447
|
-
/* istanbul ignore next */
|
|
5448
5453
|
const getStore$1 = (t, store) => t.objectStore(store);
|
|
5449
5454
|
|
|
5455
|
+
/* istanbul ignore next */
|
|
5450
5456
|
/**
|
|
5451
5457
|
* @param {any} lower
|
|
5452
5458
|
* @param {any} upper
|
|
5453
5459
|
* @param {boolean} lowerOpen
|
|
5454
5460
|
* @param {boolean} upperOpen
|
|
5455
5461
|
*/
|
|
5456
|
-
/* istanbul ignore next */
|
|
5457
5462
|
const createIDBKeyRangeBound = (lower, upper, lowerOpen, upperOpen) => IDBKeyRange.bound(lower, upper, lowerOpen, upperOpen);
|
|
5458
5463
|
|
|
5459
5464
|
/* istanbul ignore next */
|
|
@@ -6923,5 +6928,5 @@
|
|
|
6923
6928
|
}
|
|
6924
6929
|
});
|
|
6925
6930
|
|
|
6926
|
-
}()
|
|
6931
|
+
})();
|
|
6927
6932
|
//# sourceMappingURL=test.js.map
|