FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
VSpaceCode/src/version.ts at master · VSpaceCode/VSpaceCode · GitHub
VSpaceCode
/
VSpaceCode
Public
Notifications
You must be signed in to change notification settings
Fork
129
Star
1.5k
Code
Issues
66
Pull requests
13
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
VSpaceCode
/
src
/
version.ts
Copy path
More file actions
More file actions
Latest commit
History
History
History
69 lines (58 loc) · 1.55 KB
Breadcrumbs
VSpaceCode
/
src
/
version.ts
Copy path
File metadata and controls
69 lines (58 loc) · 1.55 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
export
class
Version
{
private
_major
:
number
;
private
_minor
:
number
;
private
_patch
:
number
;
constructor
(
major
:
number
,
minor
:
number
,
patch
:
number
)
{
this
.
_major
=
major
;
this
.
_minor
=
minor
;
this
.
_patch
=
patch
;
}
get
major
(
)
{
return
this
.
_major
;
}
get
minor
(
)
{
return
this
.
_minor
;
}
get
patch
(
)
{
return
this
.
_patch
;
}
compare
(
other
:
Version
)
{
if
(
this
.
_major
>
other
.
_major
)
{
return
ComparisonResult
.
Newer
;
}
if
(
this
.
_major
<
other
.
_major
)
{
return
ComparisonResult
.
Older
;
}
if
(
this
.
_minor
>
other
.
_minor
)
{
return
ComparisonResult
.
Newer
;
}
if
(
this
.
_minor
<
other
.
_minor
)
{
return
ComparisonResult
.
Older
;
}
if
(
this
.
_patch
>
other
.
_patch
)
{
return
ComparisonResult
.
Newer
;
}
if
(
this
.
_patch
<
other
.
_patch
)
{
return
ComparisonResult
.
Older
;
}
return
ComparisonResult
.
Same
;
}
static
compare
(
v1
:
Version
|
string
,
v2
:
Version
|
string
)
{
if
(
typeof
v1
===
"string"
)
{
v1
=
this
.
parse
(
v1
)
;
}
if
(
typeof
v2
===
"string"
)
{
v2
=
this
.
parse
(
v2
)
;
}
return
v1
.
compare
(
v2
)
;
}
static
parse
(
v
:
string
)
{
const
[
major
,
minor
,
patch
]
=
v
.
split
(
"."
)
.
map
(
(
v
)
=>
parseInt
(
v
,
10
)
)
;
return
new
Version
(
major
,
minor
,
patch
)
;
}
}
export
enum
ComparisonResult
{
Older
=
-
1
,
Same
=
0
,
Newer
=
1
,
}
Back
|
FazBrowse Home
|
New Git URL