UNPKG
tu-view-plus
Version:
latest (1.0.2)
1.0.2
1.0.1
github.com/tujindong/tu-view-plus
tujindong/tu-view-plus
tu-view-plus
/
es
/
src
/
image
/
utils
/
normalize-image-size-prop.mjs
13 lines
(12 loc)
•
268 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
import
{ isUndefined
as
o, isNumber
as
t }
from
"@tu-view-plus/utils"
;
function
i
(
r
) {
if
(
o
(r))
return
;
if
(!
t
(r) &&
/^\d+(%)$/
.
test
(r))
return
r;
const
n =
parseInt
(r,
10
);
return
t
(n) ?
`
${n}
px`
:
void
0
; }
export
{ i
as
normalizeImageSizeProp };