fix: make style util function work when a style only has true as value
This commit is contained in:
parent
b71a15536d
commit
0bec8a8a76
|
@ -7,7 +7,9 @@ export function c(input: Array<string | boolean> | object): string {
|
||||||
|
|
||||||
export function s(styles: object): string {
|
export function s(styles: object): string {
|
||||||
return Object.keys(styles)
|
return Object.keys(styles)
|
||||||
.filter((key: keyof object) => styles[key] === 0 || !!styles[key])
|
.filter(
|
||||||
|
(key: keyof object) => typeof styles[key] === 'number' || (typeof styles[key] === 'string' && !!styles[key])
|
||||||
|
)
|
||||||
.map((key: keyof object) => `${key}:${styles[key]}`)
|
.map((key: keyof object) => `${key}:${styles[key]}`)
|
||||||
.join(';');
|
.join(';');
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue