* Extract the formatCode from a numRef > numCache > formatCode structure.
(refNode: SafeXmlNode)
| 136 | * Extract the formatCode from a numRef > numCache > formatCode structure. |
| 137 | */ |
| 138 | function extractFormatCode(refNode: SafeXmlNode): string | undefined { |
| 139 | const cache = refNode.child('numRef').exists() |
| 140 | ? refNode.child('numRef').child('numCache') |
| 141 | : refNode.child('numCache') |
| 142 | |
| 143 | if (!cache.exists()) return undefined |
| 144 | |
| 145 | const fc = cache.child('formatCode') |
| 146 | if (!fc.exists()) return undefined |
| 147 | |
| 148 | const text = fc.text() |
| 149 | return text || undefined |
| 150 | } |
| 151 | |
| 152 | /** |
| 153 | * Format a numeric value according to its numCache formatCode. |
no test coverage detected