Replace versionPathPart with function

Signed-off-by: Josh-Cena <sidachen2003@gmail.com>
This commit is contained in:
Josh-Cena 2021-06-18 19:07:59 +08:00
parent 90196bbf47
commit 2dc74ddc3f
No known key found for this signature in database
GPG key ID: C37145B818BDB68F

View file

@ -288,9 +288,13 @@ function createVersionMetadata({
// retro-compatible values
const defaultVersionLabel =
versionName === CURRENT_VERSION_NAME ? 'Next' : versionName;
const versionNameNotLast =
versionName === CURRENT_VERSION_NAME ? 'next' : versionName;
const defaultVersionPathPart = isLast ? '' : versionNameNotLast;
function getDefaultVersionPathPart() {
if (isLast) {
return '';
}
return versionName === CURRENT_VERSION_NAME ? 'next' : versionName;
}
const defaultVersionPathPart = getDefaultVersionPathPart();
const versionOptions: VersionOptions = options.versions[versionName] ?? {};