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

Index

Variables

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

Functions

Private addBaseConversion

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

    Parameters

    • destUnitType: string
    • value: number

    Returns void

Private addConversion

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

    Parameters

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

    Returns void

conversionScale

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

    Parameters

    • 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

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

    Parameters

    • tryUnit: string

      unit type to check.

    Returns boolean

    Boolean true if unit type is valid.

Legend

  • 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