Only mutate units when preceeded by a number
This commit is contained in:
parent
69d537325b
commit
e891f28fa6
1 changed files with 7 additions and 3 deletions
|
@ -18,10 +18,14 @@ utils.mutate = {
|
||||||
},
|
},
|
||||||
|
|
||||||
units: function (str) {
|
units: function (str) {
|
||||||
let mutator = function (m) {
|
let mutator = function (m, p1) {
|
||||||
return random.number(4) === 1 ? m : make.unit.unit()
|
if (random.number(4) === 1) {
|
||||||
|
return m
|
||||||
|
} else {
|
||||||
|
return p1 + make.unit.unit()
|
||||||
}
|
}
|
||||||
return str.replace(/(px|em|ex|ch|rem|mm|cm|in|pt|pc|%')/g, mutator)
|
}
|
||||||
|
return str.replace(/(\d*)(px|em|ex|ch|rem|mm|cm|in|pt|pc|%')/g, mutator)
|
||||||
},
|
},
|
||||||
|
|
||||||
random: function (str) {
|
random: function (str) {
|
||||||
|
|
Loading…
Reference in a new issue