export function arrRotate(input: Array, n: number): Array { if (!Array.isArray(input)) { throw new TypeError(`Expected an array, got ${typeof input}`); } const x = [...input]; return x.splice(-n % x.length).concat(x); }