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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 | 4x 4x 4x | import {Entity} from '../types'
export function single(this: Entity, v: string, t: number) {
Iif (t < 0) return NaN
if (this.variables[v].is_time) {
return Array.isArray(this.time.value) && t < this.time.value.length ? this.time.value[t] : NaN
} else {
v = this.variables[v].code
return 0 === t && v in this.data ? this.data[v] : NaN
}
}
export function multi(this: Entity, v: string, t: number) {
Iif (t < 0) return NaN
if (this.variables[v].is_time) {
return Array.isArray(this.time.value) ? this.time.value[t] : this.time.value
} else {
v = this.variables[v].code
const value = this.data[v]
return (
v in this.data ?
Array.isArray(value) ?
t < value.length ?
value[t]
: NaN
: 0 === t ? value
: NaN
: NaN
)
}
}
export function row_time(
this: {i: number; o: number; format_value: Function},
d: number[],
type: string,
row: {offset: number; int: boolean},
) {
const i = this.i - (row.offset - this.o)
return (
d && i >= 0 && i < d.length ?
'number' === typeof d[i] ?
this.format_value(d[i], row.int)
: d[i]
: NaN
)
}
|