mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-03 22:29:01 +02:00
301d007d1f
[web] Skip mongoose object transformations for the split test cache GitOrigin-RevId: 8fb5420f6f938c0ab7cfe1ca82c107c7ce3522ca
21 lines
380 B
JavaScript
21 lines
380 B
JavaScript
const _ = require('lodash')
|
|
|
|
function getCurrentVersion(splitTest) {
|
|
if (splitTest?.versions?.length > 0) {
|
|
return _.maxBy(splitTest.versions, 'versionNumber')
|
|
} else {
|
|
return undefined
|
|
}
|
|
}
|
|
|
|
function getVersion(splitTest, versionNumber) {
|
|
return _.find(splitTest.versions || [], {
|
|
versionNumber,
|
|
})
|
|
}
|
|
|
|
module.exports = {
|
|
getCurrentVersion,
|
|
getVersion,
|
|
}
|