Firmware upload is functional
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { SemVer } from "semver";
|
||||
import { LenConstraint } from "../api/ServerApi";
|
||||
|
||||
/**
|
||||
@@ -6,3 +7,16 @@ import { LenConstraint } from "../api/ServerApi";
|
||||
export function lenValid(s: string, c: LenConstraint): boolean {
|
||||
return s.length >= c.min && s.length <= c.max;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check out whether a given version number respect semantics requirements or not
|
||||
*/
|
||||
export function checkVersion(v: string): boolean {
|
||||
try {
|
||||
new SemVer(v, { loose: false });
|
||||
return true;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user