okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
407ea8192
main
1export type Window = { start :number ; end :number }; 2export function mergeWindows ( windows :Window [], gap = 0 ) :Window [] { 3windows . sort (( a , b ) => a . start - b . start ); 4const result :Window [] = []; 5for ( const w of windows ) { 6const last = result . at ( - 1 ); 7if ( last && w . start < last . end ) last . end = w . end ; 8else result . push ( w ); 9} 10return result ; 11}