getUnit method

  1. @DefineMethod(name: 'get-unit')
Anonymous getUnit (Dimension n)
@DefineMethod(name: 'get-unit')

get-unit Returns units of a number.

If the argument contains a number with units, the function returns its units. The argument without units results in an empty return value. Parameters: number: a number with or without units. Example: get-unit(5px) Output: px Example: get-unit(5) Output: //nothing

Implementation

//
/// Parameters:
///   number: a number with or without units.
///   Example: get-unit(5px)
///   Output: px
/// Example: get-unit(5)
///   Output: //nothing
///
@DefineMethod(name: 'get-unit')
Anonymous getUnit(Dimension n) => Anonymous(n.unit);