1 | function mod(x, y) {
|
2 | return x - y * Math.floor(x / y);
|
3 | }
|
4 | function concat$(x, ...ys) {
|
5 | for (var y of ys)
|
6 | x.push(...y);
|
7 | return x;
|
8 | }
|
9 | function rotate(x, n = 0) {
|
10 | var n = mod(n, x.length);
|
11 | return concat$(x.slice(n), x.slice(0, n));
|
12 | }
|
13 | export { rotate as default };
|