Comparing version 0.2.42 to 0.2.43
@@ -42,3 +42,3 @@ | ||
strBuilder.push(`<details><summary><b>[lib0/${mod.name}]</b> ${descHead}</summary>`) | ||
strBuilder.push(`<pre>import * as ${mod.name} from 'lib0/${fileName}'</pre>`) | ||
strBuilder.push(`<pre>import * as ${mod.name} from 'lib0/${fileName.slice(0, -3)}'</pre>`) | ||
if (descRest.length > 0) { | ||
@@ -45,0 +45,0 @@ strBuilder.push(descRest) |
@@ -0,4 +1,7 @@ | ||
/** | ||
* @type {CustomElementRegistry} | ||
*/ | ||
export const registry: CustomElementRegistry; | ||
export function define(name: string, constr: any, opts?: ElementDefinitionOptions | undefined): void; | ||
export function whenDefined(name: string): Promise<void>; | ||
export function whenDefined(name: string): Promise<CustomElementConstructor>; | ||
/** | ||
@@ -5,0 +8,0 @@ * @template S |
@@ -18,2 +18,5 @@ /* eslint-env browser */ | ||
/** | ||
* @type {CustomElementRegistry} | ||
*/ | ||
export const registry = customElements | ||
@@ -30,3 +33,3 @@ | ||
* @param {string} name | ||
* @return {Promise<void>} | ||
* @return {Promise<CustomElementConstructor>} | ||
*/ | ||
@@ -33,0 +36,0 @@ export const whenDefined = name => registry.whenDefined(name) |
@@ -0,4 +1,7 @@ | ||
/** | ||
* @type {CustomElementRegistry} | ||
*/ | ||
export const registry: CustomElementRegistry; | ||
export function define(name: string, constr: any, opts?: ElementDefinitionOptions | undefined): void; | ||
export function whenDefined(name: string): Promise<void>; | ||
export function whenDefined(name: string): Promise<CustomElementConstructor>; | ||
/** | ||
@@ -5,0 +8,0 @@ * @template S |
@@ -15,4 +15,4 @@ export function rtop(request: IDBRequest): Promise<any>; | ||
export function queryFirst(store: IDBObjectStore, query: IDBKeyRange | null, direction: 'next' | 'prev' | 'nextunique' | 'prevunique'): Promise<any>; | ||
export function getLastKey(store: IDBObjectStore): Promise<any>; | ||
export function getFirstKey(store: IDBObjectStore): Promise<any>; | ||
export function getLastKey(store: IDBObjectStore, range?: IDBKeyRange | null | undefined): Promise<any>; | ||
export function getFirstKey(store: IDBObjectStore, range?: IDBKeyRange | null | undefined): Promise<any>; | ||
export function getAllKeysValues(store: IDBObjectStore, range?: IDBKeyRange | undefined): Promise<Array<KeyValuePair>>; | ||
@@ -19,0 +19,0 @@ export function iterate(store: IDBObjectStore, keyrange: IDBKeyRange | null, f: (arg0: any, arg1: any) => void | boolean, direction?: 'next' | 'prev' | 'nextunique' | 'prevunique'): Promise<void>; |
@@ -13,2 +13,3 @@ export const MAX_SAFE_INTEGER: number; | ||
export const isNaN: (number: unknown) => boolean; | ||
export const parseInt: (string: string, radix?: number | undefined) => number; | ||
//# sourceMappingURL=number.d.ts.map |
@@ -6,2 +6,3 @@ export function create<T>(f: (arg0: PromiseResolve<T>, arg1: (arg0: Error) => void) => any): Promise<T>; | ||
export function resolve<T>(res: void | T): Promise<void | T>; | ||
export function resolveWith<T>(res: T): Promise<T>; | ||
export function until(timeout: number, check: () => boolean, intervalResolution?: number | undefined): Promise<void>; | ||
@@ -8,0 +9,0 @@ export function wait(timeout: number): Promise<undefined>; |
@@ -28,3 +28,3 @@ /** | ||
shouldConnect: boolean; | ||
_checkInterval: NodeJS.Timeout; | ||
_checkInterval: NodeJS.Timer; | ||
/** | ||
@@ -31,0 +31,0 @@ * @param {any} message |
@@ -7,2 +7,3 @@ /** | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -12,5 +13,5 @@ * @param {string} s | ||
*/ | ||
/* istanbul ignore next */ | ||
export const create = s => new Error(s) | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -20,3 +21,2 @@ * @throws {Error} | ||
*/ | ||
/* istanbul ignore next */ | ||
export const methodUnimplemented = () => { | ||
@@ -26,2 +26,3 @@ throw create('Method unimplemented') | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -31,5 +32,4 @@ * @throws {Error} | ||
*/ | ||
/* istanbul ignore next */ | ||
export const unexpectedCase = () => { | ||
throw create('Unexpected case') | ||
} |
@@ -15,4 +15,4 @@ export function rtop(request: IDBRequest): Promise<any>; | ||
export function queryFirst(store: IDBObjectStore, query: IDBKeyRange | null, direction: 'next' | 'prev' | 'nextunique' | 'prevunique'): Promise<any>; | ||
export function getLastKey(store: IDBObjectStore): Promise<any>; | ||
export function getFirstKey(store: IDBObjectStore): Promise<any>; | ||
export function getLastKey(store: IDBObjectStore, range?: IDBKeyRange | null | undefined): Promise<any>; | ||
export function getFirstKey(store: IDBObjectStore, range?: IDBKeyRange | null | undefined): Promise<any>; | ||
export function getAllKeysValues(store: IDBObjectStore, range?: IDBKeyRange | undefined): Promise<Array<KeyValuePair>>; | ||
@@ -19,0 +19,0 @@ export function iterate(store: IDBObjectStore, keyrange: IDBKeyRange | null, f: (arg0: any, arg1: any) => void | boolean, direction?: 'next' | 'prev' | 'nextunique' | 'prevunique'): Promise<void>; |
@@ -6,3 +6,3 @@ /* eslint-env browser */ | ||
* | ||
* @module idb | ||
* @module indexeddb | ||
*/ | ||
@@ -13,2 +13,3 @@ | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -20,3 +21,2 @@ * IDB Request to Promise transformer | ||
*/ | ||
/* istanbul ignore next */ | ||
export const rtop = request => promise.create((resolve, reject) => { | ||
@@ -33,2 +33,3 @@ /* istanbul ignore next */ | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -39,3 +40,2 @@ * @param {string} name | ||
*/ | ||
/* istanbul ignore next */ | ||
export const openDB = (name, initDB) => promise.create((resolve, reject) => { | ||
@@ -72,8 +72,9 @@ const request = indexedDB.open(name) | ||
/* istanbul ignore next */ | ||
/** | ||
* @param {string} name | ||
*/ | ||
/* istanbul ignore next */ | ||
export const deleteDB = name => rtop(indexedDB.deleteDatabase(name)) | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -83,3 +84,2 @@ * @param {IDBDatabase} db | ||
*/ | ||
/* istanbul ignore next */ | ||
export const createStores = (db, definitions) => definitions.forEach(d => | ||
@@ -101,2 +101,3 @@ // @ts-ignore | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -107,6 +108,6 @@ * @param {IDBObjectStore} store | ||
*/ | ||
/* istanbul ignore next */ | ||
export const count = (store, range) => | ||
rtop(store.count(range)) | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -117,6 +118,6 @@ * @param {IDBObjectStore} store | ||
*/ | ||
/* istanbul ignore next */ | ||
export const get = (store, key) => | ||
rtop(store.get(key)) | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -126,6 +127,6 @@ * @param {IDBObjectStore} store | ||
*/ | ||
/* istanbul ignore next */ | ||
export const del = (store, key) => | ||
rtop(store.delete(key)) | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -136,6 +137,6 @@ * @param {IDBObjectStore} store | ||
*/ | ||
/* istanbul ignore next */ | ||
export const put = (store, item, key) => | ||
rtop(store.put(item, key)) | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -147,6 +148,6 @@ * @param {IDBObjectStore} store | ||
*/ | ||
/* istanbul ignore next */ | ||
export const add = (store, item, key) => | ||
rtop(store.add(item, key)) | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -157,6 +158,6 @@ * @param {IDBObjectStore} store | ||
*/ | ||
/* istanbul ignore next */ | ||
export const addAutoKey = (store, item) => | ||
rtop(store.add(item)) | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -167,6 +168,6 @@ * @param {IDBObjectStore} store | ||
*/ | ||
/* istanbul ignore next */ | ||
export const getAll = (store, range) => | ||
rtop(store.getAll(range)) | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -177,3 +178,2 @@ * @param {IDBObjectStore} store | ||
*/ | ||
/* istanbul ignore next */ | ||
export const getAllKeys = (store, range) => | ||
@@ -201,11 +201,13 @@ rtop(store.getAllKeys(range)) | ||
* @param {IDBObjectStore} store | ||
* @param {IDBKeyRange?} [range] | ||
* @return {Promise<any>} | ||
*/ | ||
export const getLastKey = store => queryFirst(store, null, 'prev') | ||
export const getLastKey = (store, range = null) => queryFirst(store, range, 'prev') | ||
/** | ||
* @param {IDBObjectStore} store | ||
* @param {IDBKeyRange?} [range] | ||
* @return {Promise<any>} | ||
*/ | ||
export const getFirstKey = store => queryFirst(store, null, 'prev') | ||
export const getFirstKey = (store, range = null) => queryFirst(store, range, 'next') | ||
@@ -219,2 +221,3 @@ /** | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -225,3 +228,2 @@ * @param {IDBObjectStore} store | ||
*/ | ||
/* istanbul ignore next */ | ||
export const getAllKeysValues = (store, range) => | ||
@@ -231,2 +233,3 @@ // @ts-ignore | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -237,3 +240,2 @@ * @param {any} request | ||
*/ | ||
/* istanbul ignore next */ | ||
const iterateOnRequest = (request, f) => promise.create((resolve, reject) => { | ||
@@ -254,2 +256,3 @@ /* istanbul ignore next */ | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -262,6 +265,6 @@ * Iterate on keys and values | ||
*/ | ||
/* istanbul ignore next */ | ||
export const iterate = (store, keyrange, f, direction = 'next') => | ||
iterateOnRequest(store.openCursor(keyrange, direction), cursor => f(cursor.value, cursor.key)) | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -275,6 +278,6 @@ * Iterate on the keys (no values) | ||
*/ | ||
/* istanbul ignore next */ | ||
export const iterateKeys = (store, keyrange, f, direction = 'next') => | ||
iterateOnRequest(store.openKeyCursor(keyrange, direction), cursor => f(cursor.key)) | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -286,5 +289,5 @@ * Open store from transaction | ||
*/ | ||
/* istanbul ignore next */ | ||
export const getStore = (t, store) => t.objectStore(store) | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -296,5 +299,5 @@ * @param {any} lower | ||
*/ | ||
/* istanbul ignore next */ | ||
export const createIDBKeyRangeBound = (lower, upper, lowerOpen, upperOpen) => IDBKeyRange.bound(lower, upper, lowerOpen, upperOpen) | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -304,5 +307,5 @@ * @param {any} upper | ||
*/ | ||
/* istanbul ignore next */ | ||
export const createIDBKeyRangeUpperBound = (upper, upperOpen) => IDBKeyRange.upperBound(upper, upperOpen) | ||
/* istanbul ignore next */ | ||
/** | ||
@@ -312,3 +315,2 @@ * @param {any} lower | ||
*/ | ||
/* istanbul ignore next */ | ||
export const createIDBKeyRangeLowerBound = (lower, lowerOpen) => IDBKeyRange.lowerBound(lower, lowerOpen) |
@@ -13,2 +13,3 @@ export const MAX_SAFE_INTEGER: number; | ||
export const isNaN: (number: unknown) => boolean; | ||
export const parseInt: (string: string, radix?: number | undefined) => number; | ||
//# sourceMappingURL=number.d.ts.map |
@@ -26,1 +26,2 @@ /** | ||
export const isNaN = Number.isNaN | ||
export const parseInt = Number.parseInt |
{ | ||
"name": "lib0", | ||
"version": "0.2.42", | ||
"version": "0.2.43", | ||
"description": "", | ||
@@ -50,4 +50,4 @@ "sideEffects": false, | ||
}, | ||
"./condititons.js": "./condititons.js", | ||
"./dist/condititons.cjs": "./dist/condititons.cjs", | ||
"./conditions.js": "./conditions.js", | ||
"./dist/conditions.cjs": "./dist/conditions.cjs", | ||
"./conditions": { | ||
@@ -54,0 +54,0 @@ "import": "./condititons.js", |
@@ -6,2 +6,3 @@ export function create<T>(f: (arg0: PromiseResolve<T>, arg1: (arg0: Error) => void) => any): Promise<T>; | ||
export function resolve<T>(res: void | T): Promise<void | T>; | ||
export function resolveWith<T>(res: T): Promise<T>; | ||
export function until(timeout: number, check: () => boolean, intervalResolution?: number | undefined): Promise<void>; | ||
@@ -8,0 +9,0 @@ export function wait(timeout: number): Promise<undefined>; |
@@ -50,2 +50,9 @@ /** | ||
/** | ||
* @template T | ||
* @param {T} res | ||
* @return {Promise<T>} | ||
*/ | ||
export const resolveWith = res => Promise.resolve(res) | ||
/** | ||
* @todo Next version, reorder parameters: check, [timeout, [intervalResolution]] | ||
@@ -52,0 +59,0 @@ * |
@@ -47,3 +47,3 @@ /** | ||
import * as log from './logging.js' | ||
import { simpleDiff } from './diff.js' | ||
import { simpleDiffString } from './diff.js' | ||
import * as object from './object.js' | ||
@@ -155,2 +155,5 @@ import * as string from './string.js' | ||
let lastTime = start | ||
/** | ||
* @type {any} | ||
*/ | ||
let err = null | ||
@@ -378,3 +381,3 @@ performance.mark(`${name}-start`) | ||
if (a !== b) { | ||
const diff = simpleDiff(a, b) | ||
const diff = simpleDiffString(a, b) | ||
log.print(log.GREY, a.slice(0, diff.index), log.RED, a.slice(diff.index, diff.remove), log.GREEN, diff.insert, log.GREY, a.slice(diff.index + diff.remove)) | ||
@@ -381,0 +384,0 @@ fail(m) |
@@ -28,3 +28,3 @@ /** | ||
shouldConnect: boolean; | ||
_checkInterval: NodeJS.Timeout; | ||
_checkInterval: NodeJS.Timer; | ||
/** | ||
@@ -31,0 +31,0 @@ * @param {any} message |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2192013
30142
1292