RenaiApp/src/renderer/services/utils.ts

21 lines
667 B
TypeScript
Raw Normal View History

export function c(input: Array<string | boolean> | object): string {
const array = Array.isArray(input)
2019-06-30 02:00:26 +02:00
? input.filter((el: any) => typeof el === 'string')
: Object.keys(input).filter((key: keyof object) => !!input[key]);
return array.join(' ');
}
export function s(styles: object): string {
return Object.keys(styles)
.filter(
(key: keyof object) => typeof styles[key] === 'number' || (typeof styles[key] === 'string' && !!styles[key])
)
.map((key: keyof object) => `${key}:${styles[key]}`)
.join(';');
}
export function t(text: string): string {
// If you want to implement frontend translation, begin here.
return text;
}