Dimension constructor
- dynamic value,
- [dynamic unit]
value
is int/double or String
unit
is Unit or String
Implementation
Dimension(dynamic value, [dynamic unit]) {
this.value = (value is String)
? double.parse(value)
: (value is num)
? value.toDouble()
: throw LessExceptionError(
LessError(message: 'Dimension is not a number.'));
this.unit = (unit is Unit)
? unit
: (unit == null) ? Unit() : Unit(<String>[unit as String]);
setParent(this.unit, this);
//3.0.0 20170111
// var Dimension = function (value, unit) {
// this.value = parseFloat(value);
// if (isNaN(this.value)) {
// throw new Error("Dimension is not a number.");
// }
// this.unit = (unit && unit instanceof Unit) ? unit :
// new Unit(unit ? [unit] : undefined);
// this.setParent(this.unit, this);
// };
}