forked from MapComplete/MapComplete
		
	Improvements to the climbing theme
This commit is contained in:
		
							parent
							
								
									a9aff5e16e
								
							
						
					
					
						commit
						5a94e9d239
					
				
					 6 changed files with 65 additions and 47 deletions
				
			
		|  | @ -73,12 +73,25 @@ export class Denomination { | |||
|      *                   en: "meter" | ||||
|      *               } | ||||
|      *           }, "test") | ||||
|      *  unit.canonicalValue("42m") // =>"42 m"
 | ||||
|      * unit.canonicalValue("42m") // =>"42 m"
 | ||||
|      * unit.canonicalValue("42") // =>"42 m"
 | ||||
|      * unit.canonicalValue("42 m") // =>"42 m"
 | ||||
|      * unit.canonicalValue("42 meter") // =>"42 m"
 | ||||
|      *  | ||||
|      *  | ||||
|      * // Should be trimmed if canonical is empty
 | ||||
|      * const unit = new Denomination({ | ||||
|      *               canonicalDenomination: "", | ||||
|      *               alternativeDenomination: ["meter","m], | ||||
|      *               'default': true, | ||||
|      *               human: { | ||||
|      *                   en: "meter" | ||||
|      *               } | ||||
|      *           }, "test") | ||||
|      * unit.canonicalValue("42m") // =>"42"
 | ||||
|      * unit.canonicalValue("42") // =>"42"
 | ||||
|      * unit.canonicalValue("42 m") // =>"42"
 | ||||
|      * unit.canonicalValue("42 meter") // =>"42"
 | ||||
|      */ | ||||
|     public canonicalValue(value: string, actAsDefault?: boolean) : string { | ||||
|         if (value === undefined) { | ||||
|  | @ -89,9 +102,9 @@ export class Denomination { | |||
|             return null; | ||||
|         } | ||||
|         if (stripped === "1" && this._canonicalSingular !== undefined) { | ||||
|             return "1 " + this._canonicalSingular | ||||
|             return ("1 " + this._canonicalSingular).trim() | ||||
|         } | ||||
|         return stripped + " " + this.canonical; | ||||
|         return (stripped + " " + this.canonical).trim(); | ||||
|     } | ||||
| 
 | ||||
|     /** | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue