diff --git a/README.md b/README.md index 75f1ed6..917bd23 100644 --- a/README.md +++ b/README.md @@ -1977,7 +1977,7 @@ collection.all(); #### `push()` -The push method appends an item to the end of the collection: +The push method appends items to the end of the collection: ```js const collection = collect([1, 2, 3, 4]); diff --git a/docs/api/push.md b/docs/api/push.md index 50d4ff1..1f384c9 100644 --- a/docs/api/push.md +++ b/docs/api/push.md @@ -1,6 +1,6 @@ # `push()` -The push method appends an item to the end of the collection: +The push method appends items to the end of the collection: ```js const collection = collect([1, 2, 3, 4]); diff --git a/index.d.ts b/index.d.ts index 95618a0..f3780e4 100644 --- a/index.d.ts +++ b/index.d.ts @@ -303,9 +303,9 @@ declare module 'collect.js' { pull(key: keyof Item | K): Item | null; /** - * The push method appends an item to the end of the collection. + * The push method appends items to the end of the collection. */ - push(item: Item): this; + push(...item: Item[]): this; /** * The put method sets the given key and value in the collection. diff --git a/test/methods/push_test.js b/test/methods/push_test.js index 06e0560..a2de9c6 100644 --- a/test/methods/push_test.js +++ b/test/methods/push_test.js @@ -19,9 +19,7 @@ module.exports = (it, expect, collect) => { const collection = collect([1, 2, 3, 4]); expect(collection.all()).to.eql([1, 2, 3, 4]); - const values = [1, 2, 3, 4, 5]; - - collection.push(...values); + collection.push(1, 2, 3, 4, 5); expect(collection.all()).to.eql([1, 2, 3, 4, 1, 2, 3, 4, 5]); }); };