mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-18 00:34:28 +08:00
migrate transaction statistics page to composition API and typescript
This commit is contained in:
+12
-2
@@ -1,4 +1,4 @@
|
||||
import type { TypeAndDisplayName } from '@/core/base.ts';
|
||||
import type { TypeAndName, TypeAndDisplayName } from '@/core/base.ts';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-function-type
|
||||
export function isFunction(val: unknown): val is Function {
|
||||
@@ -37,7 +37,7 @@ export function isBoolean(val: unknown): val is boolean {
|
||||
return typeof(val) === 'boolean';
|
||||
}
|
||||
|
||||
export function isYearMonth(val: unknown): boolean {
|
||||
export function isYearMonth(val: unknown): val is string {
|
||||
if (!isString(val)) {
|
||||
return false;
|
||||
}
|
||||
@@ -312,6 +312,16 @@ export function getItemByKeyValue<T>(src: Record<string, T>[] | Record<string, R
|
||||
return null;
|
||||
}
|
||||
|
||||
export function findNameByType(items: TypeAndName[], type: number): string | null {
|
||||
for (const item of items) {
|
||||
if (item.type === type) {
|
||||
return item.name;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
export function findDisplayNameByType(items: TypeAndDisplayName[], type: number): string | null {
|
||||
for (const item of items) {
|
||||
if (item.type === type) {
|
||||
|
||||
Reference in New Issue
Block a user