octo-deno/make/units.js

18 lines
520 B
JavaScript
Raw Normal View History

2017-04-22 20:16:47 +00:00
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
2017-04-12 19:18:23 +00:00
make.units = {
lengthUnit: function () {
return random.pick([
"px", "em", "ex", "ch", "rem", "mm", "cm", "in", "pt", "pc", "%"
]);
},
length: function () {
2017-04-22 19:02:38 +00:00
return make.numbers.number() + make.units.lengthUnit();
2017-04-12 19:18:23 +00:00
},
percent: function () {
2017-04-22 19:02:38 +00:00
return make.numbers.number() + "%";
2017-04-12 19:18:23 +00:00
},
};