Skip to content

Commit c42d8fe

Browse files
author
mmarchois
committed
Fix pagination
1 parent 065ee0a commit c42d8fe

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

client/src/utils/array.js

+5-8
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
1-
export const range = function* (start, end, step = 1) {
2-
let i = start;
3-
4-
while (i <= end) {
5-
yield i;
6-
i += step;
7-
}
8-
};
1+
export const range = (from, to, step = 1, offset = 0) => (
2+
[...Array(to).keys()]
3+
.map((i) => (i + 1) * step + offset)
4+
.filter((i) => Boolean(i >= from && i <= to))
5+
);

0 commit comments

Comments
 (0)