Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | 4x 4x 4x 4x 6x | import DataHandler from './index'
import {Settings} from '../types'
import {patterns} from './patterns'
export function value(this: {settings: Settings}, v: null | number, int?: boolean): number | string {
if (null === v || isNaN(v)) {
return NaN
} else if (int) {
return v
} else {
return 'number' !== typeof this.settings.settings.digits
? v
: v.toFixed(this.settings.settings.digits > 0 ? this.settings.settings.digits : 0)
}
}
export function label(this: DataHandler, l: string): string {
return 'string' !== typeof l
? ''
: l in this.variables && this.variables[l].meta && this.variables[l].meta.short_name
? this.variables[l].meta.short_name
: l.replace(patterns.seps, ' ').replace(patterns.word_start, function (w) {
return w.toUpperCase()
})
}
|