Skip to content
This repository was archived by the owner on Sep 29, 2024. It is now read-only.

Commit 05952ee

Browse files
committed
Support multiplication and division by number primatives
1 parent 09ebc15 commit 05952ee

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/CSSNumericValue.js

+8
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ export default class CSSNumericValue {
3939
const values = []
4040

4141
for (let arg of args) {
42+
if (typeof arg === 'number') {
43+
arg = new CSSUnitValue(arg, 'number')
44+
}
45+
4246
if (arg instanceof Constructor) {
4347
if (values.length || result.unit !== arg.unit && arg.unit !== 'number') {
4448
values.push(arg)
@@ -99,6 +103,10 @@ export default class CSSNumericValue {
99103
const values = []
100104

101105
for (let arg of args) {
106+
if (typeof arg === 'number') {
107+
arg = new CSSUnitValue(arg, 'number')
108+
}
109+
102110
if (arg instanceof Constructor) {
103111
if (values.length || result.unit !== arg.unit && arg.unit !== 'number') {
104112
values.push(arg)

0 commit comments

Comments
 (0)