forked from MapComplete/MapComplete
17 lines
426 B
TypeScript
17 lines
426 B
TypeScript
|
import { Validator } from "../Validator"
|
||
|
|
||
|
export default class TranslationValidator extends Validator {
|
||
|
constructor() {
|
||
|
super("translation", "Makes sure the the string is of format `Record<string, string>` ")
|
||
|
}
|
||
|
|
||
|
isValid(value: string, getCountry?: () => string): boolean {
|
||
|
try {
|
||
|
JSON.parse(value)
|
||
|
return true
|
||
|
} catch (e) {
|
||
|
return false
|
||
|
}
|
||
|
}
|
||
|
}
|