fix: escape symbols in the samples lang name (#703)

Co-authored-by: Anton Kozachuk <antonkozachuk@Antons-MacBook-Pro.local>
This commit is contained in:
Anton Kozachuk
2022-05-25 17:31:25 +03:00
committed by GitHub
parent fb11aaa0e7
commit 0694e714f3
4 changed files with 92 additions and 3 deletions

View File

@@ -74,6 +74,13 @@ export function pathToFilename(path: string, pathSeparator: string) {
.replace(/\//g, pathSeparator);
}
export function escapeLanguageName(lang: string) {
return lang
.replace(/#/g, "_sharp")
.replace(/\//, '_')
.replace(/\s/g, '');
}
export class CircularJSONNotSupportedError extends Error {
constructor(public originalError: Error) {
super(originalError.message);