Better trimming of canonical values, no console output if not actually rewriting

This commit is contained in:
pietervdvn 2021-07-10 21:03:17 +02:00
parent 80cb9efaf0
commit e594511e22
2 changed files with 5 additions and 2 deletions

View file

@ -152,7 +152,7 @@ export class Denomination {
if (stripped === null) {
return null;
}
return stripped + " " + this.canonical.trim()
return (stripped + " " + this.canonical.trim()).trim();
}
/**

View file

@ -95,7 +95,10 @@ export default class SimpleMetaTagger {
const value = feature.properties[key]
const [, denomination] = unit.findDenomination(value)
let canonical = denomination?.canonicalValue(value) ?? undefined;
console.log("Rewritten ", key, " from", value, "into", canonical)
if(canonical === value){
break;
}
console.log("Rewritten ", key, ` from '${value}' into '${canonical}'`)
if(canonical === undefined && !unit.eraseInvalid) {
break;
}