overleaf/services/web/frontend/js/utils/splitTestUtils.ts
ilkin-overleaf c6289cc67f Merge pull request #14773 from overleaf/ii-modify-design-system-update-split-test
[web] Modify design-system-update split test

GitOrigin-RevId: f28aeef5ba782006afd30fd2862d0ad129077f6c
2023-09-18 08:03:49 +00:00

18 lines
523 B
TypeScript

import getMeta from './meta'
export function isSplitTestEnabled(name: string) {
return getMeta('ol-splitTestVariants')?.[name] === 'enabled'
}
export function getSplitTestVariant(name: string, fallback?: string) {
return getMeta('ol-splitTestVariants')?.[name] || fallback
}
export function parseIntFromSplitTest(name: string, defaultValue: number) {
const v = getMeta('ol-splitTestVariants')?.[name]
const n = parseInt(v, 10)
if (v === 'default' || Number.isNaN(n)) {
return defaultValue
}
return n
}