toDimensionUnit

[ Function ]

public static toDimensionUnit(
    value: string,
    defaultValue: DimensionUnit | null = null
): DimensionUnit | null;

Checks whether a value is a dimension unit and returns it.

Parameter

Name

Type

Description

value

string

The value to convert.

defaultValue

DimensionUnit, null

This value is returned if the first parameter is not valid. Null applies if this parameter is not passed.

Return value

Type

Description

DimensionUnit, null

Returns the appropriate value or null in the event of an error.

toDimensionUnit 1:

Available from 1.8