-
Notifications
You must be signed in to change notification settings - Fork 57
Expand file tree
/
Copy pathstat.ts
More file actions
22 lines (18 loc) · 665 Bytes
/
stat.ts
File metadata and controls
22 lines (18 loc) · 665 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { identifySiteKey } from "./site"
/**
* Copyright (c) 2022 Hengyang Zhang
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
export function isNotZeroResult(target: timer.core.Result): boolean {
return !!target.focus || !!target.time
}
export function resultOf(focus: number, time: number): timer.core.Result {
return { focus, time }
}
export const ALL_DIMENSIONS: timer.core.Dimension[] = ['focus', 'time']
export function identifyStatKey(rowKey: timer.stat.StatKey) {
const { siteKey, date, cateKey } = rowKey || {}
return [date ?? '', identifySiteKey(siteKey), cateKey ?? ''].join('_')
}