Skip to content
This repository was archived by the owner on Jan 1, 2025. It is now read-only.

Commit d61782c

Browse files
committed
fix(spread): adding spread to push
1 parent 64370ec commit d61782c

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,13 +187,13 @@ export class QuickDB<D = any> {
187187
return this.addSubtract(key, value, true);
188188
}
189189

190-
async push<T = D>(key: string, value: T): Promise<T[]> {
190+
async push<T = D>(key: string, ...values: T[]): Promise<T[]> {
191191
if (typeof key != "string")
192192
throw new Error("First argument (key) needs to be a string");
193-
if (value == null) throw new Error("Missing second argument (value)");
193+
if (values.length === 0) throw new Error("Missing second argument (value)");
194194

195195
const currentArr = await this.getArray<T>(key);
196-
currentArr.push(value);
196+
currentArr.push(...values);
197197

198198
return this.set(key, currentArr);
199199
}

0 commit comments

Comments
 (0)