mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-11 10:38:31 -05:00
Merge from master
This commit is contained in:
@@ -2,7 +2,6 @@
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
'use strict';
|
||||
|
||||
import * as nls from 'vs/nls';
|
||||
import pkg from 'vs/platform/node/package';
|
||||
@@ -16,7 +15,7 @@ export interface IParsedVersion {
|
||||
minorMustEqual: boolean;
|
||||
patchBase: number;
|
||||
patchMustEqual: boolean;
|
||||
preRelease: string;
|
||||
preRelease: string | null;
|
||||
}
|
||||
|
||||
export interface INormalizedVersion {
|
||||
@@ -36,7 +35,7 @@ export function isValidVersionStr(version: string): boolean {
|
||||
return (version === '*' || VERSION_REGEXP.test(version));
|
||||
}
|
||||
|
||||
export function parseVersion(version: string): IParsedVersion {
|
||||
export function parseVersion(version: string): IParsedVersion | null {
|
||||
if (!isValidVersionStr(version)) {
|
||||
return null;
|
||||
}
|
||||
@@ -58,6 +57,9 @@ export function parseVersion(version: string): IParsedVersion {
|
||||
}
|
||||
|
||||
let m = version.match(VERSION_REGEXP);
|
||||
if (!m) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
hasCaret: m[1] === '^',
|
||||
hasGreaterEquals: m[1] === '>=',
|
||||
@@ -71,7 +73,7 @@ export function parseVersion(version: string): IParsedVersion {
|
||||
};
|
||||
}
|
||||
|
||||
export function normalizeVersion(version: IParsedVersion): INormalizedVersion {
|
||||
export function normalizeVersion(version: IParsedVersion | null): INormalizedVersion | null {
|
||||
if (!version) {
|
||||
return null;
|
||||
}
|
||||
@@ -104,14 +106,14 @@ export function normalizeVersion(version: IParsedVersion): INormalizedVersion {
|
||||
}
|
||||
|
||||
export function isValidVersion(_version: string | INormalizedVersion, _desiredVersion: string | INormalizedVersion): boolean {
|
||||
let version: INormalizedVersion;
|
||||
let version: INormalizedVersion | null;
|
||||
if (typeof _version === 'string') {
|
||||
version = normalizeVersion(parseVersion(_version));
|
||||
} else {
|
||||
version = _version;
|
||||
}
|
||||
|
||||
let desiredVersion: INormalizedVersion;
|
||||
let desiredVersion: INormalizedVersion | null;
|
||||
if (typeof _desiredVersion === 'string') {
|
||||
desiredVersion = normalizeVersion(parseVersion(_desiredVersion));
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user