octo-deno/lib/make/units.ts

22 lines
556 B
TypeScript
Raw Normal View History

2017-04-22 22:49:49 +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/. */
2020-02-04 12:49:42 +00:00
import random from "../random/random.ts";
import numbers from "./numbers";
2020-02-04 12:49:42 +00:00
export default class unit{
static unit () {
2017-04-22 22:49:49 +00:00
return random.pick([
'px', 'em', 'ex', 'ch', 'rem', 'mm', 'cm', 'in', 'pt', 'pc', '%'
])
}
2020-02-04 12:49:42 +00:00
static len () {
return numbers.any() + unit.unit()
}
static percent () {
2020-02-04 12:49:42 +00:00
return `${numbers.any()}%`
}
2020-02-04 12:49:42 +00:00
}