mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
27 lines
592 B
TypeScript
27 lines
592 B
TypeScript
|
import { UpdateRange } from '../services/types/update'
|
||
|
|
||
|
export const computeUpdateRange = (
|
||
|
updateRange: UpdateRange,
|
||
|
fromV: number,
|
||
|
toV: number,
|
||
|
updateMetaEndTimestamp: number
|
||
|
) => {
|
||
|
const fromVersion = Math.min(fromV, updateRange.fromV)
|
||
|
const toVersion = Math.max(toV, updateRange.toV)
|
||
|
const fromVTimestamp = Math.min(
|
||
|
updateMetaEndTimestamp,
|
||
|
updateRange.fromVTimestamp
|
||
|
)
|
||
|
const toVTimestamp = Math.max(
|
||
|
updateMetaEndTimestamp,
|
||
|
updateRange.toVTimestamp
|
||
|
)
|
||
|
|
||
|
return {
|
||
|
fromV: fromVersion,
|
||
|
toV: toVersion,
|
||
|
fromVTimestamp,
|
||
|
toVTimestamp,
|
||
|
}
|
||
|
}
|