We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 64370ec commit d61782cCopy full SHA for d61782c
1 file changed
src/index.ts
@@ -187,13 +187,13 @@ export class QuickDB<D = any> {
187
return this.addSubtract(key, value, true);
188
}
189
190
- async push<T = D>(key: string, value: T): Promise<T[]> {
+ async push<T = D>(key: string, ...values: T[]): Promise<T[]> {
191
if (typeof key != "string")
192
throw new Error("First argument (key) needs to be a string");
193
- if (value == null) throw new Error("Missing second argument (value)");
+ if (values.length === 0) throw new Error("Missing second argument (value)");
194
195
const currentArr = await this.getArray<T>(key);
196
- currentArr.push(value);
+ currentArr.push(...values);
197
198
return this.set(key, currentArr);
199
0 commit comments