Comparing version 1.8.1 to 1.8.2
@@ -310,3 +310,3 @@ var __create = Object.create; | ||
cursor = list.cursor; | ||
const done = cursor === null; | ||
const done = cursor === ""; | ||
return { value: list.result, done }; | ||
@@ -320,4 +320,5 @@ }; | ||
const it = this.iterator(prefix); | ||
let result = await it.next(); | ||
while (!result.done) { | ||
let done = false; | ||
while (!done) { | ||
const result = await it.next(); | ||
const list = result.value; | ||
@@ -330,11 +331,13 @@ for (let i = 0; i < list.length; i++) { | ||
} | ||
done = result.done; | ||
} | ||
await kvBatch.finish(); | ||
}; | ||
delPrefix = async (prefixName, chunk) => { | ||
const kvBatch = new KVBatch({ kvApi: this.kvApi }); | ||
delPrefix = async (prefixName, chunkSize) => { | ||
const kvBatch = new KVBatch({ kvApi: this.kvApi }, { chunkSize }); | ||
const prefix = this.createPrefixKey(prefixName); | ||
const it = this.iterator(prefix); | ||
let result = await it.next(); | ||
while (!result.done) { | ||
let done = false; | ||
while (!done) { | ||
let result = await it.next(); | ||
const keys = result.value.map((v) => v.key); | ||
@@ -345,3 +348,3 @@ for (let i = 0; i < keys.length; i++) { | ||
} | ||
result = await it.next(); | ||
done = result.done; | ||
} | ||
@@ -348,0 +351,0 @@ await kvBatch.finish(); |
@@ -74,4 +74,4 @@ import KVApi, { KeyValuePair, SetOptions } from './kvApi'; | ||
updatePrefix: (chunkSize?: number) => Promise<void>; | ||
delPrefix: (prefixName: string, chunk?: number) => Promise<void>; | ||
delPrefix: (prefixName: string, chunkSize?: number) => Promise<void>; | ||
} | ||
export {}; |
{ | ||
"name": "superkv", | ||
"version": "1.8.1", | ||
"version": "1.8.2", | ||
"author": "g45t345rt", | ||
@@ -22,2 +22,3 @@ "license": "ISC", | ||
"test:kvItem": "jest -i test/kvItem.test.ts", | ||
"test:updatePrefix": "jest -i test/updatePrefix.test.ts", | ||
"test:dist": "jest -i test/dist.test.ts", | ||
@@ -24,0 +25,0 @@ "build": "ts-node build.ts && tsc --emitDeclarationOnly --outDir dist", |
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
52879
1320