Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 50x 1724x 50x 1484x 1484x 50x 2x 2x 2x 2x 2x 2x | export function addUniqueItem<T>(arr: T[], item: T) { arr.indexOf(item) === -1 && arr.push(item) } export function removeItem<T>(arr: T[], item: T) { const index = arr.indexOf(item) index > -1 && arr.splice(index, 1) } // Adapted from array-move export function moveItem<T>([...arr]: T[], fromIndex: number, toIndex: number) { const startIndex = fromIndex < 0 ? arr.length + fromIndex : fromIndex Eif (startIndex >= 0 && startIndex < arr.length) { const endIndex = toIndex < 0 ? arr.length + toIndex : toIndex const [item] = arr.splice(fromIndex, 1) arr.splice(endIndex, 0, item) } return arr } |