forked from MapComplete/MapComplete
chore: automated housekeeping...
This commit is contained in:
parent
14b2799f08
commit
4add2d1aff
151 changed files with 4561 additions and 3315 deletions
|
|
@ -3,12 +3,18 @@ import { Translation } from "../../i18n/Translation"
|
|||
import Translations from "../../i18n/Translations"
|
||||
|
||||
export default class StringValidator extends Validator {
|
||||
|
||||
constructor(type?: string, doc?: string, inputmode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search", textArea?: boolean) {
|
||||
super(type ?? "string",
|
||||
constructor(
|
||||
type?: string,
|
||||
doc?: string,
|
||||
inputmode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search",
|
||||
textArea?: boolean
|
||||
) {
|
||||
super(
|
||||
type ?? "string",
|
||||
doc ?? "A simple piece of text which is at most 255 characters long",
|
||||
inputmode,
|
||||
textArea)
|
||||
textArea
|
||||
)
|
||||
}
|
||||
|
||||
isValid(s: string): boolean {
|
||||
|
|
|
|||
|
|
@ -42,8 +42,10 @@ export default class WikidataValidator extends Validator {
|
|||
"notInstanceof",
|
||||
"A list of Q-identifiers which indicates that the search results _must not_ be an entity of this type, e.g. [`Q79007`](https://www.wikidata.org/wiki/Q79007) to filter away all streets from the search results",
|
||||
],
|
||||
["multiple",
|
||||
"If 'yes' or 'true', will allow to select multiple values at once"]
|
||||
[
|
||||
"multiple",
|
||||
"If 'yes' or 'true', will allow to select multiple values at once",
|
||||
],
|
||||
]
|
||||
),
|
||||
]),
|
||||
|
|
@ -145,7 +147,12 @@ Another example is to search for species and trees:
|
|||
* WikidataValidator.removePostAndPrefixes("Elf-Julistraat", [], {"nl":["straat", "laan"], "en": ["street"]}, "nl") // => "Elf-Juli"
|
||||
* WikidataValidator.removePostAndPrefixes("Elf-Julistraat", [], {"nl":["straat", "laan"], "en": ["street"]}, "en") // => "Elf-Julistraat"
|
||||
*/
|
||||
public static removePostAndPrefixes(searchTerm: string, prefixesToRemove: string[] | Record<string, string[]>, postfixesToRemove: string[] | Record<string, string[]>, language: string): string {
|
||||
public static removePostAndPrefixes(
|
||||
searchTerm: string,
|
||||
prefixesToRemove: string[] | Record<string, string[]>,
|
||||
postfixesToRemove: string[] | Record<string, string[]>,
|
||||
language: string
|
||||
): string {
|
||||
const prefixes = prefixesToRemove
|
||||
const postfixes = postfixesToRemove
|
||||
const prefixesUnwrapped: RegExp[] = (
|
||||
|
|
@ -156,7 +163,6 @@ Another example is to search for species and trees:
|
|||
Array.isArray(postfixes) ? postfixes : postfixes[language] ?? []
|
||||
).map((s) => new RegExp(s + "$", "i"))
|
||||
|
||||
|
||||
let clipped = searchTerm.trim()
|
||||
|
||||
for (const postfix of postfixesUnwrapped) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue