forked from MapComplete/MapComplete
Fix: fix small typing issues
This commit is contained in:
parent
5a0866ff08
commit
fd5e39065d
1 changed files with 5 additions and 21 deletions
|
@ -64,7 +64,7 @@ export class Denomination {
|
|||
throw `${context} uses the old 'default'-key. Use "useIfNoUnitGiven" or "useAsDefaultInput" instead`
|
||||
}
|
||||
|
||||
const humanTexts = typeof json.human === "string" ? Translations.T(json.human) : new Translation(json.human)
|
||||
const humanTexts: TypedTranslation<{ quantity: string }> = Translations.T(json.human)
|
||||
humanTexts.OnEveryLanguage((text, language) => {
|
||||
if (text.indexOf("{quantity}") < 0) {
|
||||
throw `In denomination: a human text should contain {quantity} (at ${context}.human.${language}). The offending text is: ${text}`
|
||||
|
@ -85,21 +85,6 @@ export class Denomination {
|
|||
)
|
||||
}
|
||||
|
||||
public clone() {
|
||||
return new Denomination(
|
||||
this.canonical,
|
||||
this._canonicalSingular,
|
||||
this.useIfNoUnitGiven,
|
||||
this.prefix,
|
||||
this.addSpace,
|
||||
this.alternativeDenominations,
|
||||
this.human,
|
||||
this.humanSingular,
|
||||
this.validator,
|
||||
this.factorToCanonical
|
||||
)
|
||||
}
|
||||
|
||||
public withBlankCanonical() {
|
||||
return new Denomination(
|
||||
"",
|
||||
|
@ -181,18 +166,17 @@ export class Denomination {
|
|||
}
|
||||
|
||||
value = value.toLowerCase()
|
||||
const self = this
|
||||
|
||||
function startsWith(key) {
|
||||
if (self.prefix) {
|
||||
const startsWith = (key) => {
|
||||
if (this.prefix) {
|
||||
return value.startsWith(key)
|
||||
} else {
|
||||
return value.endsWith(key)
|
||||
}
|
||||
}
|
||||
|
||||
function substr(key) {
|
||||
if (self.prefix) {
|
||||
const substr = (key) => {
|
||||
if (this.prefix) {
|
||||
return value.substring(key.length).trim()
|
||||
}
|
||||
let trimmed = value.substring(0, value.length - key.length).trim()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue