UNPKG

@openhps/core

Version:

Open Hybrid Positioning System - Core component

37 lines 1.79 kB
/** * @category Unit */ export class UnitPrefix { constructor(name, abbrevation, magnitude) { this.name = name; this.abbrevation = abbrevation; this.magnitude = magnitude; } get namePattern() { return new RegExp(`/^${this.name}/g`); } get abbrevationPattern() { return new RegExp(`/^${this.abbrevation}/g`); } } UnitPrefix.DECA = new UnitPrefix('deca', 'da', 1e1); UnitPrefix.HECTO = new UnitPrefix('hecto', 'h', 1e2); UnitPrefix.KILO = new UnitPrefix('kilo', 'k', 1e3); UnitPrefix.MEGA = new UnitPrefix('mega', 'M', 1e6); UnitPrefix.GIGA = new UnitPrefix('giga', 'G', 1e9); UnitPrefix.TERA = new UnitPrefix('tera', 'T', 1e12); UnitPrefix.PETA = new UnitPrefix('peta', 'P', 1e15); UnitPrefix.EXA = new UnitPrefix('exa', 'E', 1e18); UnitPrefix.ZETTA = new UnitPrefix('zetta', 'Z', 1e21); UnitPrefix.YOTTA = new UnitPrefix('yotta', 'Y', 1e24); UnitPrefix.DECI = new UnitPrefix('deci', 'd', 1e-1); UnitPrefix.CENTI = new UnitPrefix('centi', 'c', 1e-2); UnitPrefix.MILLI = new UnitPrefix('milli', 'm', 1e-3); UnitPrefix.MICRO = new UnitPrefix('micro', 'u', 1e-6); UnitPrefix.NANO = new UnitPrefix('nano', 'n', 1e-9); UnitPrefix.PICO = new UnitPrefix('pico', 'p', 1e-12); UnitPrefix.FEMTO = new UnitPrefix('femto', 'f', 1e-15); UnitPrefix.ATTO = new UnitPrefix('atto', 'a', 1e-18); UnitPrefix.ZEPTO = new UnitPrefix('zepto', 'z', 1e-21); UnitPrefix.YOCTO = new UnitPrefix('yocto', 'y', 1e-24); UnitPrefix.DECIMAL = [UnitPrefix.DECA, UnitPrefix.HECTO, UnitPrefix.KILO, UnitPrefix.MEGA, UnitPrefix.GIGA, UnitPrefix.TERA, UnitPrefix.PETA, UnitPrefix.EXA, UnitPrefix.ZETTA, UnitPrefix.YOTTA, UnitPrefix.DECI, UnitPrefix.CENTI, UnitPrefix.MILLI, UnitPrefix.MICRO, UnitPrefix.NANO, UnitPrefix.PICO, UnitPrefix.FEMTO, UnitPrefix.ATTO, UnitPrefix.ZEPTO, UnitPrefix.YOCTO];