Files
Aislo/B07_wf4_DesignDetail/openwebcad/src/helpers/wrap-module.ts
T
2026-07-19 17:01:48 +09:00

12 lines
267 B
TypeScript

// Wraps the index so that if you go past the length it resets to 0
// ["one", "two", "three"]
// index maps like this
// 0 => 0
// 1 => 1
// 2 => 2
// 3 => 0
// 4 => 1
export function wrapModule(index: number, length: number) {
return (index + length) % length;
}