Skip to content

Commit

Permalink
fix: 🐛 fixing a missing undefined check in css length parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
Tony Sullivan committed Oct 30, 2022
1 parent fec2506 commit 08bda4b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/css.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ export function isCssLength(string_: string): string_ is CSSLength {
].some(regex => regex.test(string_))
}

export function parseCssLength(value: string | number): CSSLength | undefined {
export function parseCssLength(value: string | number | undefined | null): CSSLength | undefined {
if (!value) { return undefined }

return typeof value === 'number'
? value >= 0
? `${value}px`
Expand Down

0 comments on commit 08bda4b

Please sign in to comment.