octo-deno/lib/make/units.ts

22 lines
556 B
TypeScript

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