mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
Merge branch 'master' into feat/663
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
import { coerce, lt, valid } from "semver";
|
||||
import { tryit } from "./error.helpers";
|
||||
|
||||
export function safeLt(a: string, b: string): boolean {
|
||||
const { result } = tryit(() => lt(valid(coerce(a)), valid(coerce(b))));
|
||||
return result ?? false;
|
||||
}
|
||||
|
||||
@@ -11,3 +11,8 @@ export function findHashInString(str: string, algorithm: keyof typeof HashAlgori
|
||||
const match = regex.exec(str);
|
||||
return match ? match[0] : undefined;
|
||||
}
|
||||
|
||||
export function escapeRegExp(str: string): string {
|
||||
// Regex taken from lodash escapeRegExp function
|
||||
return str.replace(/[\\^$.*+?()[\]{}|]/g, '\\$&');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user