Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 15 lines (10 sloc) 272 Bytes
export function shift<T>(array: T[]) {
const { length } = array;
const firstValue = array[0];
for (let index = 1; index < length; index += 1) {
const value = array[index];
array[index - 1] = value;
}
array.length = length - 1;
return firstValue;
}
You can’t perform that action at this time.