You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

14 lines
486 B

4 years ago
  1. # `forPage()`
  2. The forPage method returns a new collection containing the items that would be present on a given page number. The method accepts the page number as its first argument and the number of items to show per page as its second argument:
  3. ```js
  4. const collection = collect([1, 2, 3, 4, 5, 6, 7, 8, 9]);
  5. const forPage = collection.forPage(2, 3);
  6. forPage.all();
  7. // [4, 5, 6]
  8. ```
  9. [View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/forPage.js)