forked from MapComplete/MapComplete
More tests
This commit is contained in:
parent
82e59bc1eb
commit
50d383279d
5 changed files with 76 additions and 86 deletions
|
@ -60,7 +60,27 @@ export class Denomination {
|
|||
)
|
||||
}
|
||||
|
||||
public canonicalValue(value: string, actAsDefault?: boolean) {
|
||||
/**
|
||||
* Create a representation of the given value
|
||||
* @param value: the value from OSM
|
||||
* @param actAsDefault: if set and the value can be parsed as number, will be parsed and trimmed
|
||||
*
|
||||
* const unit = new Denomination({
|
||||
* canonicalDenomination: "m",
|
||||
* alternativeDenomination: ["meter"],
|
||||
* 'default': true,
|
||||
* human: {
|
||||
* en: "meter"
|
||||
* }
|
||||
* }, "test")
|
||||
* unit.canonicalValue("42m") // =>"42 m"
|
||||
* unit.canonicalValue("42") // =>"42 m"
|
||||
* unit.canonicalValue("42 m") // =>"42 m"
|
||||
* unit.canonicalValue("42 meter") // =>"42 m"
|
||||
*
|
||||
*
|
||||
*/
|
||||
public canonicalValue(value: string, actAsDefault?: boolean) : string {
|
||||
if (value === undefined) {
|
||||
return undefined;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue