Maker.js, a Microsoft Garage project, is a JavaScript library for creating and sharing modular line drawings for CNC and laser cutters.

View project on GitHub Star

Api - units Module



Private base

base: string

The base type is arbitrary. Other conversions are then based off of this.

Private table

table: object

Table of conversions. Lazy load upon first conversion.

Type declaration

  • [unitType: string]: object
    • [unitType: string]: number


Private addBaseConversion

  • addBaseConversion(destUnitType: string, value: number): void
  • Add a conversion of the base unit.


    • destUnitType: string
    • value: number

    Returns void

Private addConversion

  • addConversion(srcUnitType: string, destUnitType: string, value: number): void
  • Add a conversion, and its inversion.


    • srcUnitType: string
    • destUnitType: string
    • value: number

    Returns void


  • conversionScale(srcUnitType: string, destUnitType: string): number
  • Get a conversion ratio between a source unit and a destination unit.


    • srcUnitType: string

      unitType converting from.

    • destUnitType: string

      unitType converting to.

    Returns number

    Numeric ratio of the conversion.

Private init

  • init(): void
  • Initialize all known conversions here.

    Returns void


  • isValidUnit(tryUnit: string): boolean
  • Check to see if unit type is a valid Maker.js unit.


    • tryUnit: string

      unit type to check.

    Returns boolean

    Boolean true if unit type is valid.


  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc