⚠️ This is pre-release documentation for v3. For stable docs, visit v2.
Skip to content

@tmlmt/cooklang-parser / UnitDefinition

Interface: UnitDefinition

Represents a fully defined unit with conversion and alias information

Extends

Properties

aliases

aliases: string[]

e.g. ['gram', 'grams']


integerProtected?

optional integerProtected: boolean

This property is set to true when the unit is prefixed by an = sign in the cooklang file, e.g. =g Indicates that quantities with this unit should be treated as integers only (no decimal/fractional values).

Inherited from

Unit.integerProtected


name

name: string

Inherited from

Unit.name


system

system: UnitSystem


toBase

toBase: number

Conversion factor to the base unit of its type


type

type: UnitType