Skip to content

Commit

Permalink
Fix pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
mmarchois committed May 3, 2022
1 parent 065ee0a commit c42d8fe
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions client/src/utils/array.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
export const range = function* (start, end, step = 1) {
let i = start;

while (i <= end) {
yield i;
i += step;
}
};
export const range = (from, to, step = 1, offset = 0) => (
[...Array(to).keys()]
.map((i) => (i + 1) * step + offset)
.filter((i) => Boolean(i >= from && i <= to))
);

0 comments on commit c42d8fe

Please sign in to comment.