Documents for @litert/utils-string
    Preparing search index...

    Interface IUnitParserOptions

    The options for the UnitParser.

    interface IUnitParserOptions {
        caseInsensitive?: boolean;
        format: string;
        maxDecimalPlaces?: number;
        units: readonly (string | IUnitInfo)[];
    }
    Index

    Properties

    caseInsensitive?: boolean

    Whether to ignore case when matching the unit.

    The unit name in the parse result will be kept in the same case as the unit property.

    true
    
    format: string

    The format of the string to parse.

    Use placeholders {value} and {unit} to specify where the value and unit should be.

    "{value} {unit}"
    
    maxDecimalPlaces?: number

    How many digits to allow after the decimal point.

    2
    
    units: readonly (string | IUnitInfo)[]

    The list of units to parse.

    If a string is provided, it will be converted to an object { name, aliases: [name] }.

    So that the name will also be an alias.

    ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]
    
    ["cm", "m", "km", "in", "ft", "mi"]