-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.d.ts
More file actions
28 lines (26 loc) · 945 Bytes
/
index.d.ts
File metadata and controls
28 lines (26 loc) · 945 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
/**
* Rotates the array `num` places to the left, i.e. it shifts `num` items out of the array and pushes them back on the end.
* The reverse is done when `num` is negative.
* In addition, `rotate` automatically wraps rotations which are larger than `array.length`.
*
* @example
*
* var beatles = ['paul', 'john', 'ringo', 'george'];
* rotate(beatles, 2);
* console.log(beatles); // [ 'ringo', 'george', 'paul', 'john' ]
*/
declare function rotate<T>(array: T[], num: number): T[];
export = rotate;
/**
* Returns all rotations for the given array. It does not modify the passed in array.
*
* @example
*
* var beatles = ['paul', 'john', 'ringo', 'george'];
* console.log(rotate.all(beatles));
* // [ [ 'paul', 'john', 'ringo', 'george' ],
* // [ 'john', 'ringo', 'george', 'paul' ],
* // [ 'ringo', 'george', 'paul', 'john' ],
* // [ 'george', 'paul', 'john', 'ringo' ] ]
*/
export function all<T>(array: T[]): T[][];