Added tsc check and other small things

This commit is contained in:
DrMint 2022-05-07 11:19:46 +02:00
parent 349f53ea27
commit fcd4ba9385
3 changed files with 17 additions and 1 deletions

View File

@ -7,7 +7,8 @@
"postbuild": "next-sitemap",
"start": "next start",
"lint": "next lint",
"generate": "graphql-codegen --config graphql-codegen.js"
"generate": "graphql-codegen --config graphql-codegen.js",
"tsc": "tsc"
},
"dependencies": {
"@fontsource/material-icons": "^4.5.4",

View File

@ -53,6 +53,16 @@ export enum ImageQuality {
Og = "og",
}
export function getAssetFilename(path: string): string {
let result = path.split("/");
result = result[result.length - 1].split(".");
result = result
.splice(0, result.length - 1)
.join(".")
.split("_");
return result[0];
}
export function getAssetURL(url: string, quality: ImageQuality): string {
let newUrl = url;
newUrl = newUrl.replace(/^\/uploads/u, `/${quality}`);

View File

@ -443,3 +443,8 @@ export function getPreferredLanguage(
}
return undefined;
}
export function isInteger(value: string): boolean {
// eslint-disable-next-line require-unicode-regexp
return /^[+-]?[0-9]+$/.test(value);
}