@magic/semver 0.0.17 → 0.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/package.json +1 -1
- package/src/parse.js +2 -2
- package/src/serialize.js +3 -1
package/README.md
CHANGED
package/package.json
CHANGED
package/src/parse.js
CHANGED
|
@@ -29,7 +29,7 @@ export const parse = v => {
|
|
|
29
29
|
|
|
30
30
|
/** @type {VersionResult} */
|
|
31
31
|
const result = {
|
|
32
|
-
major: parseInt(major),
|
|
32
|
+
major: parseInt(major.replace('v', '')),
|
|
33
33
|
minor: parseInt(minor),
|
|
34
34
|
patch: -1,
|
|
35
35
|
v,
|
|
@@ -48,7 +48,7 @@ export const parse = v => {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
if (!is.number(result.major)) {
|
|
51
|
-
throw error(`${libName} major was not an Int: ${result.major}`, 'E_MAJOR_TYPE')
|
|
51
|
+
throw error(`${libName} major was not an Int: ${v} ${result.major}`, 'E_MAJOR_TYPE')
|
|
52
52
|
} else if (!is.number(result.minor)) {
|
|
53
53
|
throw error(`${libName} minor was not an Int: ${result.minor}`, 'E_MINOR_TYPE')
|
|
54
54
|
} else if (!is.number(result.patch)) {
|
package/src/serialize.js
CHANGED
|
@@ -55,5 +55,7 @@ export const serialize = v => {
|
|
|
55
55
|
demoString = `-${string}.${version}`
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
|
|
58
|
+
const prefix = is.str(v.v) && v.v.startsWith('v') ? 'v' : ''
|
|
59
|
+
|
|
60
|
+
return `${prefix}${major}.${minor}.${patch}${demoString}`
|
|
59
61
|
}
|