UNPKG

296 BJavaScriptView Raw
1'use strict';
2function mod(x, y) {
3 return x - y * Math.floor(x / y);
4}
5function concat$(x, ...ys) {
6 for (var y of ys)
7 x.push(...y);
8 return x;
9}
10function rotate(x, n = 0) {
11 var n = mod(n, x.length);
12 return concat$(x.slice(n), x.slice(0, n));
13}
14module.exports = rotate;