platform/packages/presentation/src/attributes.ts
Pete Anøther e361325a73
UBER-1083: Use hours and minutes to present less than a day durations (#4111)
Signed-off-by: Petr Vyazovetskiy <develop.pit@gmail.com>
2023-12-01 14:27:56 +07:00

21 lines
541 B
TypeScript

import { type AnyAttribute, type Client } from '@hcengineering/core'
/**
* @public
*/
export interface KeyedAttribute {
key: string
attr: AnyAttribute
}
export { updateAttribute } from '@hcengineering/core'
export function getAttribute (client: Client, object: any, key: KeyedAttribute): any {
// Check if attr is mixin and return its value
if (client.getHierarchy().isMixin(key.attr.attributeOf)) {
return (client.getHierarchy().as(object, key.attr.attributeOf) as any)[key.key]
} else {
return object[key.key]
}
}