forked from MapComplete/MapComplete
Chore: reformat all files with prettier
This commit is contained in:
parent
5757ae5dea
commit
d008dcb54d
214 changed files with 8926 additions and 8196 deletions
|
@ -1,7 +1,7 @@
|
|||
import {Translation} from "../../i18n/Translation.js"
|
||||
import { Translation } from "../../i18n/Translation.js"
|
||||
import Translations from "../../i18n/Translations.js"
|
||||
import * as emailValidatorLibrary from "email-validator"
|
||||
import {Validator} from "../Validator"
|
||||
import { Validator } from "../Validator"
|
||||
|
||||
export default class EmailValidator extends Validator {
|
||||
constructor() {
|
||||
|
|
|
@ -1,24 +1,23 @@
|
|||
import {parsePhoneNumberFromString} from "libphonenumber-js"
|
||||
import {Validator} from "../Validator"
|
||||
import {Translation} from "../../i18n/Translation";
|
||||
import Translations from "../../i18n/Translations";
|
||||
import { parsePhoneNumberFromString } from "libphonenumber-js"
|
||||
import { Validator } from "../Validator"
|
||||
import { Translation } from "../../i18n/Translation"
|
||||
import Translations from "../../i18n/Translations"
|
||||
|
||||
export default class PhoneValidator extends Validator {
|
||||
constructor() {
|
||||
super("phone", "A phone number", "tel")
|
||||
}
|
||||
|
||||
|
||||
getFeedback(s: string, requestCountry?: () => string): Translation {
|
||||
if(this.isValid(s, requestCountry)){
|
||||
if (this.isValid(s, requestCountry)) {
|
||||
return undefined
|
||||
}
|
||||
const tr = Translations.t.validation.phone
|
||||
const generic = tr.feedback
|
||||
if(requestCountry){
|
||||
const country = requestCountry()
|
||||
if(country){
|
||||
return tr.feedbackCountry.Subs({country})
|
||||
if (requestCountry) {
|
||||
const country = requestCountry()
|
||||
if (country) {
|
||||
return tr.feedbackCountry.Subs({ country })
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -44,7 +43,7 @@ export default class PhoneValidator extends Validator {
|
|||
str = str.substring("tel:".length)
|
||||
}
|
||||
let countryCode = undefined
|
||||
if(country){
|
||||
if (country) {
|
||||
countryCode = country()
|
||||
}
|
||||
return parsePhoneNumberFromString(
|
||||
|
|
|
@ -2,6 +2,11 @@ import { Validator } from "../Validator"
|
|||
|
||||
export default class TextValidator extends Validator {
|
||||
constructor() {
|
||||
super("text", "A longer piece of text. Uses an textArea instead of a textField", "text", true)
|
||||
super(
|
||||
"text",
|
||||
"A longer piece of text. Uses an textArea instead of a textField",
|
||||
"text",
|
||||
true
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue