unitsnet-js
Version:
A better way to hold unit variables and easily convert to the destination unit
827 lines (826 loc) • 44.8 kB
JavaScript
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ElectricPotentialChangeRate = exports.ElectricPotentialChangeRateUnits = void 0;
const base_unit_1 = require("../base-unit");
/** ElectricPotentialChangeRateUnits enumeration */
var ElectricPotentialChangeRateUnits;
(function (ElectricPotentialChangeRateUnits) {
/** */
ElectricPotentialChangeRateUnits["VoltsPerSecond"] = "VoltPerSecond";
/** */
ElectricPotentialChangeRateUnits["VoltsPerMicrosecond"] = "VoltPerMicrosecond";
/** */
ElectricPotentialChangeRateUnits["VoltsPerMinute"] = "VoltPerMinute";
/** */
ElectricPotentialChangeRateUnits["VoltsPerHour"] = "VoltPerHour";
/** */
ElectricPotentialChangeRateUnits["MicrovoltsPerSecond"] = "MicrovoltPerSecond";
/** */
ElectricPotentialChangeRateUnits["MillivoltsPerSecond"] = "MillivoltPerSecond";
/** */
ElectricPotentialChangeRateUnits["KilovoltsPerSecond"] = "KilovoltPerSecond";
/** */
ElectricPotentialChangeRateUnits["MegavoltsPerSecond"] = "MegavoltPerSecond";
/** */
ElectricPotentialChangeRateUnits["MicrovoltsPerMicrosecond"] = "MicrovoltPerMicrosecond";
/** */
ElectricPotentialChangeRateUnits["MillivoltsPerMicrosecond"] = "MillivoltPerMicrosecond";
/** */
ElectricPotentialChangeRateUnits["KilovoltsPerMicrosecond"] = "KilovoltPerMicrosecond";
/** */
ElectricPotentialChangeRateUnits["MegavoltsPerMicrosecond"] = "MegavoltPerMicrosecond";
/** */
ElectricPotentialChangeRateUnits["MicrovoltsPerMinute"] = "MicrovoltPerMinute";
/** */
ElectricPotentialChangeRateUnits["MillivoltsPerMinute"] = "MillivoltPerMinute";
/** */
ElectricPotentialChangeRateUnits["KilovoltsPerMinute"] = "KilovoltPerMinute";
/** */
ElectricPotentialChangeRateUnits["MegavoltsPerMinute"] = "MegavoltPerMinute";
/** */
ElectricPotentialChangeRateUnits["MicrovoltsPerHour"] = "MicrovoltPerHour";
/** */
ElectricPotentialChangeRateUnits["MillivoltsPerHour"] = "MillivoltPerHour";
/** */
ElectricPotentialChangeRateUnits["KilovoltsPerHour"] = "KilovoltPerHour";
/** */
ElectricPotentialChangeRateUnits["MegavoltsPerHour"] = "MegavoltPerHour";
})(ElectricPotentialChangeRateUnits = exports.ElectricPotentialChangeRateUnits || (exports.ElectricPotentialChangeRateUnits = {}));
/** ElectricPotential change rate is the ratio of the electric potential change to the time during which the change occurred (value of electric potential changes per unit time). */
class ElectricPotentialChangeRate extends base_unit_1.BaseUnit {
/**
* Create a new ElectricPotentialChangeRate.
* @param value The value.
* @param fromUnit The ‘ElectricPotentialChangeRate’ unit to create from.
* The default unit is VoltsPerSecond
*/
constructor(value, fromUnit = ElectricPotentialChangeRateUnits.VoltsPerSecond) {
super();
this.voltspersecondLazy = null;
this.voltspermicrosecondLazy = null;
this.voltsperminuteLazy = null;
this.voltsperhourLazy = null;
this.microvoltspersecondLazy = null;
this.millivoltspersecondLazy = null;
this.kilovoltspersecondLazy = null;
this.megavoltspersecondLazy = null;
this.microvoltspermicrosecondLazy = null;
this.millivoltspermicrosecondLazy = null;
this.kilovoltspermicrosecondLazy = null;
this.megavoltspermicrosecondLazy = null;
this.microvoltsperminuteLazy = null;
this.millivoltsperminuteLazy = null;
this.kilovoltsperminuteLazy = null;
this.megavoltsperminuteLazy = null;
this.microvoltsperhourLazy = null;
this.millivoltsperhourLazy = null;
this.kilovoltsperhourLazy = null;
this.megavoltsperhourLazy = null;
if (value === undefined || value === null || Number.isNaN(value)) {
throw new TypeError('invalid unit value ‘' + value + '’');
}
this.value = this.convertToBase(value, fromUnit);
}
/**
* The base value of ElectricPotentialChangeRate is VoltsPerSecond.
* This accessor used when needs a value for calculations and it's better to use directly the base value
*/
get BaseValue() {
return this.value;
}
/** Gets the default unit used when creating instances of the unit or its DTO */
get baseUnit() {
return ElectricPotentialChangeRateUnits.VoltsPerSecond;
}
/** */
get VoltsPerSecond() {
if (this.voltspersecondLazy !== null) {
return this.voltspersecondLazy;
}
return this.voltspersecondLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.VoltsPerSecond);
}
/** */
get VoltsPerMicrosecond() {
if (this.voltspermicrosecondLazy !== null) {
return this.voltspermicrosecondLazy;
}
return this.voltspermicrosecondLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.VoltsPerMicrosecond);
}
/** */
get VoltsPerMinute() {
if (this.voltsperminuteLazy !== null) {
return this.voltsperminuteLazy;
}
return this.voltsperminuteLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.VoltsPerMinute);
}
/** */
get VoltsPerHour() {
if (this.voltsperhourLazy !== null) {
return this.voltsperhourLazy;
}
return this.voltsperhourLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.VoltsPerHour);
}
/** */
get MicrovoltsPerSecond() {
if (this.microvoltspersecondLazy !== null) {
return this.microvoltspersecondLazy;
}
return this.microvoltspersecondLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.MicrovoltsPerSecond);
}
/** */
get MillivoltsPerSecond() {
if (this.millivoltspersecondLazy !== null) {
return this.millivoltspersecondLazy;
}
return this.millivoltspersecondLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.MillivoltsPerSecond);
}
/** */
get KilovoltsPerSecond() {
if (this.kilovoltspersecondLazy !== null) {
return this.kilovoltspersecondLazy;
}
return this.kilovoltspersecondLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.KilovoltsPerSecond);
}
/** */
get MegavoltsPerSecond() {
if (this.megavoltspersecondLazy !== null) {
return this.megavoltspersecondLazy;
}
return this.megavoltspersecondLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.MegavoltsPerSecond);
}
/** */
get MicrovoltsPerMicrosecond() {
if (this.microvoltspermicrosecondLazy !== null) {
return this.microvoltspermicrosecondLazy;
}
return this.microvoltspermicrosecondLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.MicrovoltsPerMicrosecond);
}
/** */
get MillivoltsPerMicrosecond() {
if (this.millivoltspermicrosecondLazy !== null) {
return this.millivoltspermicrosecondLazy;
}
return this.millivoltspermicrosecondLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.MillivoltsPerMicrosecond);
}
/** */
get KilovoltsPerMicrosecond() {
if (this.kilovoltspermicrosecondLazy !== null) {
return this.kilovoltspermicrosecondLazy;
}
return this.kilovoltspermicrosecondLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.KilovoltsPerMicrosecond);
}
/** */
get MegavoltsPerMicrosecond() {
if (this.megavoltspermicrosecondLazy !== null) {
return this.megavoltspermicrosecondLazy;
}
return this.megavoltspermicrosecondLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.MegavoltsPerMicrosecond);
}
/** */
get MicrovoltsPerMinute() {
if (this.microvoltsperminuteLazy !== null) {
return this.microvoltsperminuteLazy;
}
return this.microvoltsperminuteLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.MicrovoltsPerMinute);
}
/** */
get MillivoltsPerMinute() {
if (this.millivoltsperminuteLazy !== null) {
return this.millivoltsperminuteLazy;
}
return this.millivoltsperminuteLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.MillivoltsPerMinute);
}
/** */
get KilovoltsPerMinute() {
if (this.kilovoltsperminuteLazy !== null) {
return this.kilovoltsperminuteLazy;
}
return this.kilovoltsperminuteLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.KilovoltsPerMinute);
}
/** */
get MegavoltsPerMinute() {
if (this.megavoltsperminuteLazy !== null) {
return this.megavoltsperminuteLazy;
}
return this.megavoltsperminuteLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.MegavoltsPerMinute);
}
/** */
get MicrovoltsPerHour() {
if (this.microvoltsperhourLazy !== null) {
return this.microvoltsperhourLazy;
}
return this.microvoltsperhourLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.MicrovoltsPerHour);
}
/** */
get MillivoltsPerHour() {
if (this.millivoltsperhourLazy !== null) {
return this.millivoltsperhourLazy;
}
return this.millivoltsperhourLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.MillivoltsPerHour);
}
/** */
get KilovoltsPerHour() {
if (this.kilovoltsperhourLazy !== null) {
return this.kilovoltsperhourLazy;
}
return this.kilovoltsperhourLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.KilovoltsPerHour);
}
/** */
get MegavoltsPerHour() {
if (this.megavoltsperhourLazy !== null) {
return this.megavoltsperhourLazy;
}
return this.megavoltsperhourLazy = this.convertFromBase(ElectricPotentialChangeRateUnits.MegavoltsPerHour);
}
/**
* Create a new ElectricPotentialChangeRate instance from a VoltsPerSecond
*
* @param value The unit as VoltsPerSecond to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromVoltsPerSecond(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.VoltsPerSecond);
}
/**
* Create a new ElectricPotentialChangeRate instance from a VoltsPerMicrosecond
*
* @param value The unit as VoltsPerMicrosecond to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromVoltsPerMicrosecond(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.VoltsPerMicrosecond);
}
/**
* Create a new ElectricPotentialChangeRate instance from a VoltsPerMinute
*
* @param value The unit as VoltsPerMinute to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromVoltsPerMinute(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.VoltsPerMinute);
}
/**
* Create a new ElectricPotentialChangeRate instance from a VoltsPerHour
*
* @param value The unit as VoltsPerHour to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromVoltsPerHour(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.VoltsPerHour);
}
/**
* Create a new ElectricPotentialChangeRate instance from a MicrovoltsPerSecond
*
* @param value The unit as MicrovoltsPerSecond to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromMicrovoltsPerSecond(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.MicrovoltsPerSecond);
}
/**
* Create a new ElectricPotentialChangeRate instance from a MillivoltsPerSecond
*
* @param value The unit as MillivoltsPerSecond to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromMillivoltsPerSecond(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.MillivoltsPerSecond);
}
/**
* Create a new ElectricPotentialChangeRate instance from a KilovoltsPerSecond
*
* @param value The unit as KilovoltsPerSecond to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromKilovoltsPerSecond(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.KilovoltsPerSecond);
}
/**
* Create a new ElectricPotentialChangeRate instance from a MegavoltsPerSecond
*
* @param value The unit as MegavoltsPerSecond to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromMegavoltsPerSecond(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.MegavoltsPerSecond);
}
/**
* Create a new ElectricPotentialChangeRate instance from a MicrovoltsPerMicrosecond
*
* @param value The unit as MicrovoltsPerMicrosecond to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromMicrovoltsPerMicrosecond(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.MicrovoltsPerMicrosecond);
}
/**
* Create a new ElectricPotentialChangeRate instance from a MillivoltsPerMicrosecond
*
* @param value The unit as MillivoltsPerMicrosecond to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromMillivoltsPerMicrosecond(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.MillivoltsPerMicrosecond);
}
/**
* Create a new ElectricPotentialChangeRate instance from a KilovoltsPerMicrosecond
*
* @param value The unit as KilovoltsPerMicrosecond to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromKilovoltsPerMicrosecond(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.KilovoltsPerMicrosecond);
}
/**
* Create a new ElectricPotentialChangeRate instance from a MegavoltsPerMicrosecond
*
* @param value The unit as MegavoltsPerMicrosecond to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromMegavoltsPerMicrosecond(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.MegavoltsPerMicrosecond);
}
/**
* Create a new ElectricPotentialChangeRate instance from a MicrovoltsPerMinute
*
* @param value The unit as MicrovoltsPerMinute to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromMicrovoltsPerMinute(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.MicrovoltsPerMinute);
}
/**
* Create a new ElectricPotentialChangeRate instance from a MillivoltsPerMinute
*
* @param value The unit as MillivoltsPerMinute to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromMillivoltsPerMinute(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.MillivoltsPerMinute);
}
/**
* Create a new ElectricPotentialChangeRate instance from a KilovoltsPerMinute
*
* @param value The unit as KilovoltsPerMinute to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromKilovoltsPerMinute(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.KilovoltsPerMinute);
}
/**
* Create a new ElectricPotentialChangeRate instance from a MegavoltsPerMinute
*
* @param value The unit as MegavoltsPerMinute to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromMegavoltsPerMinute(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.MegavoltsPerMinute);
}
/**
* Create a new ElectricPotentialChangeRate instance from a MicrovoltsPerHour
*
* @param value The unit as MicrovoltsPerHour to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromMicrovoltsPerHour(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.MicrovoltsPerHour);
}
/**
* Create a new ElectricPotentialChangeRate instance from a MillivoltsPerHour
*
* @param value The unit as MillivoltsPerHour to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromMillivoltsPerHour(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.MillivoltsPerHour);
}
/**
* Create a new ElectricPotentialChangeRate instance from a KilovoltsPerHour
*
* @param value The unit as KilovoltsPerHour to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromKilovoltsPerHour(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.KilovoltsPerHour);
}
/**
* Create a new ElectricPotentialChangeRate instance from a MegavoltsPerHour
*
* @param value The unit as MegavoltsPerHour to create a new ElectricPotentialChangeRate from.
* @returns The new ElectricPotentialChangeRate instance.
*/
static FromMegavoltsPerHour(value) {
return new ElectricPotentialChangeRate(value, ElectricPotentialChangeRateUnits.MegavoltsPerHour);
}
/**
* Gets the base unit enumeration associated with ElectricPotentialChangeRate
* @returns The unit enumeration that can be used to interact with this type
*/
static getUnitEnum() {
return ElectricPotentialChangeRateUnits;
}
/**
* Gets the default unit used when creating instances of the unit or its DTO
* @returns The unit enumeration value used as a default parameter in constructor and DTO methods
*/
static getBaseUnit() {
return ElectricPotentialChangeRateUnits.VoltsPerSecond;
}
/**
* Create API DTO represent a ElectricPotentialChangeRate unit.
* @param holdInUnit The specific ElectricPotentialChangeRate unit to be used in the unit representation at the DTO
*/
toDto(holdInUnit = ElectricPotentialChangeRateUnits.VoltsPerSecond) {
return {
value: this.convert(holdInUnit),
unit: holdInUnit
};
}
/**
* Create a ElectricPotentialChangeRate unit from an API DTO representation.
* @param dtoElectricPotentialChangeRate The ElectricPotentialChangeRate API DTO representation
*/
static FromDto(dtoElectricPotentialChangeRate) {
return new ElectricPotentialChangeRate(dtoElectricPotentialChangeRate.value, dtoElectricPotentialChangeRate.unit);
}
/**
* Convert ElectricPotentialChangeRate to a specific unit value.
* @param toUnit The specific unit to convert to
* @returns The value of the specific unit provided.
*/
convert(toUnit) {
switch (toUnit) {
case ElectricPotentialChangeRateUnits.VoltsPerSecond: return this.VoltsPerSecond;
case ElectricPotentialChangeRateUnits.VoltsPerMicrosecond: return this.VoltsPerMicrosecond;
case ElectricPotentialChangeRateUnits.VoltsPerMinute: return this.VoltsPerMinute;
case ElectricPotentialChangeRateUnits.VoltsPerHour: return this.VoltsPerHour;
case ElectricPotentialChangeRateUnits.MicrovoltsPerSecond: return this.MicrovoltsPerSecond;
case ElectricPotentialChangeRateUnits.MillivoltsPerSecond: return this.MillivoltsPerSecond;
case ElectricPotentialChangeRateUnits.KilovoltsPerSecond: return this.KilovoltsPerSecond;
case ElectricPotentialChangeRateUnits.MegavoltsPerSecond: return this.MegavoltsPerSecond;
case ElectricPotentialChangeRateUnits.MicrovoltsPerMicrosecond: return this.MicrovoltsPerMicrosecond;
case ElectricPotentialChangeRateUnits.MillivoltsPerMicrosecond: return this.MillivoltsPerMicrosecond;
case ElectricPotentialChangeRateUnits.KilovoltsPerMicrosecond: return this.KilovoltsPerMicrosecond;
case ElectricPotentialChangeRateUnits.MegavoltsPerMicrosecond: return this.MegavoltsPerMicrosecond;
case ElectricPotentialChangeRateUnits.MicrovoltsPerMinute: return this.MicrovoltsPerMinute;
case ElectricPotentialChangeRateUnits.MillivoltsPerMinute: return this.MillivoltsPerMinute;
case ElectricPotentialChangeRateUnits.KilovoltsPerMinute: return this.KilovoltsPerMinute;
case ElectricPotentialChangeRateUnits.MegavoltsPerMinute: return this.MegavoltsPerMinute;
case ElectricPotentialChangeRateUnits.MicrovoltsPerHour: return this.MicrovoltsPerHour;
case ElectricPotentialChangeRateUnits.MillivoltsPerHour: return this.MillivoltsPerHour;
case ElectricPotentialChangeRateUnits.KilovoltsPerHour: return this.KilovoltsPerHour;
case ElectricPotentialChangeRateUnits.MegavoltsPerHour: return this.MegavoltsPerHour;
default:
break;
}
return Number.NaN;
}
convertFromBase(toUnit) {
if (base_unit_1.areAnyOperatorsOverridden())
switch (toUnit) {
case ElectricPotentialChangeRateUnits.VoltsPerSecond: return this.value;
case ElectricPotentialChangeRateUnits.VoltsPerMicrosecond: return super.internalDivide(this.value, 1E6);
case ElectricPotentialChangeRateUnits.VoltsPerMinute: return super.internalMultiply(this.value, 60);
case ElectricPotentialChangeRateUnits.VoltsPerHour: return super.internalMultiply(this.value, 3600);
case ElectricPotentialChangeRateUnits.MicrovoltsPerSecond: return super.internalDivide(this.value, 0.000001);
case ElectricPotentialChangeRateUnits.MillivoltsPerSecond: return super.internalDivide(this.value, 0.001);
case ElectricPotentialChangeRateUnits.KilovoltsPerSecond: return super.internalDivide(this.value, 1000);
case ElectricPotentialChangeRateUnits.MegavoltsPerSecond: return super.internalDivide(this.value, 1000000);
case ElectricPotentialChangeRateUnits.MicrovoltsPerMicrosecond: {
const v3 = super.internalDivide(this.value, 1E6);
return super.internalDivide(v3, 0.000001);
}
case ElectricPotentialChangeRateUnits.MillivoltsPerMicrosecond: {
const v3 = super.internalDivide(this.value, 1E6);
return super.internalDivide(v3, 0.001);
}
case ElectricPotentialChangeRateUnits.KilovoltsPerMicrosecond: {
const v3 = super.internalDivide(this.value, 1E6);
return super.internalDivide(v3, 1000);
}
case ElectricPotentialChangeRateUnits.MegavoltsPerMicrosecond: {
const v3 = super.internalDivide(this.value, 1E6);
return super.internalDivide(v3, 1000000);
}
case ElectricPotentialChangeRateUnits.MicrovoltsPerMinute: {
const v3 = super.internalMultiply(this.value, 60);
return super.internalDivide(v3, 0.000001);
}
case ElectricPotentialChangeRateUnits.MillivoltsPerMinute: {
const v3 = super.internalMultiply(this.value, 60);
return super.internalDivide(v3, 0.001);
}
case ElectricPotentialChangeRateUnits.KilovoltsPerMinute: {
const v3 = super.internalMultiply(this.value, 60);
return super.internalDivide(v3, 1000);
}
case ElectricPotentialChangeRateUnits.MegavoltsPerMinute: {
const v3 = super.internalMultiply(this.value, 60);
return super.internalDivide(v3, 1000000);
}
case ElectricPotentialChangeRateUnits.MicrovoltsPerHour: {
const v3 = super.internalMultiply(this.value, 3600);
return super.internalDivide(v3, 0.000001);
}
case ElectricPotentialChangeRateUnits.MillivoltsPerHour: {
const v3 = super.internalMultiply(this.value, 3600);
return super.internalDivide(v3, 0.001);
}
case ElectricPotentialChangeRateUnits.KilovoltsPerHour: {
const v3 = super.internalMultiply(this.value, 3600);
return super.internalDivide(v3, 1000);
}
case ElectricPotentialChangeRateUnits.MegavoltsPerHour: {
const v3 = super.internalMultiply(this.value, 3600);
return super.internalDivide(v3, 1000000);
}
default: return Number.NaN;
}
switch (toUnit) {
case ElectricPotentialChangeRateUnits.VoltsPerSecond: return this.value;
case ElectricPotentialChangeRateUnits.VoltsPerMicrosecond: return this.value / 1E6;
case ElectricPotentialChangeRateUnits.VoltsPerMinute: return this.value * 60;
case ElectricPotentialChangeRateUnits.VoltsPerHour: return this.value * 3600;
case ElectricPotentialChangeRateUnits.MicrovoltsPerSecond: return (this.value) / 0.000001;
case ElectricPotentialChangeRateUnits.MillivoltsPerSecond: return (this.value) / 0.001;
case ElectricPotentialChangeRateUnits.KilovoltsPerSecond: return (this.value) / 1000;
case ElectricPotentialChangeRateUnits.MegavoltsPerSecond: return (this.value) / 1000000;
case ElectricPotentialChangeRateUnits.MicrovoltsPerMicrosecond: return (this.value / 1E6) / 0.000001;
case ElectricPotentialChangeRateUnits.MillivoltsPerMicrosecond: return (this.value / 1E6) / 0.001;
case ElectricPotentialChangeRateUnits.KilovoltsPerMicrosecond: return (this.value / 1E6) / 1000;
case ElectricPotentialChangeRateUnits.MegavoltsPerMicrosecond: return (this.value / 1E6) / 1000000;
case ElectricPotentialChangeRateUnits.MicrovoltsPerMinute: return (this.value * 60) / 0.000001;
case ElectricPotentialChangeRateUnits.MillivoltsPerMinute: return (this.value * 60) / 0.001;
case ElectricPotentialChangeRateUnits.KilovoltsPerMinute: return (this.value * 60) / 1000;
case ElectricPotentialChangeRateUnits.MegavoltsPerMinute: return (this.value * 60) / 1000000;
case ElectricPotentialChangeRateUnits.MicrovoltsPerHour: return (this.value * 3600) / 0.000001;
case ElectricPotentialChangeRateUnits.MillivoltsPerHour: return (this.value * 3600) / 0.001;
case ElectricPotentialChangeRateUnits.KilovoltsPerHour: return (this.value * 3600) / 1000;
case ElectricPotentialChangeRateUnits.MegavoltsPerHour: return (this.value * 3600) / 1000000;
default: return Number.NaN;
}
}
convertToBase(value, fromUnit) {
if (base_unit_1.areAnyOperatorsOverridden())
switch (fromUnit) {
case ElectricPotentialChangeRateUnits.VoltsPerSecond: return value;
case ElectricPotentialChangeRateUnits.VoltsPerMicrosecond: return super.internalMultiply(value, 1E6);
case ElectricPotentialChangeRateUnits.VoltsPerMinute: return super.internalDivide(value, 60);
case ElectricPotentialChangeRateUnits.VoltsPerHour: return super.internalDivide(value, 3600);
case ElectricPotentialChangeRateUnits.MicrovoltsPerSecond: return super.internalMultiply(value, 0.000001);
case ElectricPotentialChangeRateUnits.MillivoltsPerSecond: return super.internalMultiply(value, 0.001);
case ElectricPotentialChangeRateUnits.KilovoltsPerSecond: return super.internalMultiply(value, 1000);
case ElectricPotentialChangeRateUnits.MegavoltsPerSecond: return super.internalMultiply(value, 1000000);
case ElectricPotentialChangeRateUnits.MicrovoltsPerMicrosecond: {
const v3 = super.internalMultiply(value, 1E6);
return super.internalMultiply(v3, 0.000001);
}
case ElectricPotentialChangeRateUnits.MillivoltsPerMicrosecond: {
const v3 = super.internalMultiply(value, 1E6);
return super.internalMultiply(v3, 0.001);
}
case ElectricPotentialChangeRateUnits.KilovoltsPerMicrosecond: {
const v3 = super.internalMultiply(value, 1E6);
return super.internalMultiply(v3, 1000);
}
case ElectricPotentialChangeRateUnits.MegavoltsPerMicrosecond: {
const v3 = super.internalMultiply(value, 1E6);
return super.internalMultiply(v3, 1000000);
}
case ElectricPotentialChangeRateUnits.MicrovoltsPerMinute: {
const v3 = super.internalDivide(value, 60);
return super.internalMultiply(v3, 0.000001);
}
case ElectricPotentialChangeRateUnits.MillivoltsPerMinute: {
const v3 = super.internalDivide(value, 60);
return super.internalMultiply(v3, 0.001);
}
case ElectricPotentialChangeRateUnits.KilovoltsPerMinute: {
const v3 = super.internalDivide(value, 60);
return super.internalMultiply(v3, 1000);
}
case ElectricPotentialChangeRateUnits.MegavoltsPerMinute: {
const v3 = super.internalDivide(value, 60);
return super.internalMultiply(v3, 1000000);
}
case ElectricPotentialChangeRateUnits.MicrovoltsPerHour: {
const v3 = super.internalDivide(value, 3600);
return super.internalMultiply(v3, 0.000001);
}
case ElectricPotentialChangeRateUnits.MillivoltsPerHour: {
const v3 = super.internalDivide(value, 3600);
return super.internalMultiply(v3, 0.001);
}
case ElectricPotentialChangeRateUnits.KilovoltsPerHour: {
const v3 = super.internalDivide(value, 3600);
return super.internalMultiply(v3, 1000);
}
case ElectricPotentialChangeRateUnits.MegavoltsPerHour: {
const v3 = super.internalDivide(value, 3600);
return super.internalMultiply(v3, 1000000);
}
default: return Number.NaN;
}
switch (fromUnit) {
case ElectricPotentialChangeRateUnits.VoltsPerSecond: return value;
case ElectricPotentialChangeRateUnits.VoltsPerMicrosecond: return value * 1E6;
case ElectricPotentialChangeRateUnits.VoltsPerMinute: return value / 60;
case ElectricPotentialChangeRateUnits.VoltsPerHour: return value / 3600;
case ElectricPotentialChangeRateUnits.MicrovoltsPerSecond: return (value) * 0.000001;
case ElectricPotentialChangeRateUnits.MillivoltsPerSecond: return (value) * 0.001;
case ElectricPotentialChangeRateUnits.KilovoltsPerSecond: return (value) * 1000;
case ElectricPotentialChangeRateUnits.MegavoltsPerSecond: return (value) * 1000000;
case ElectricPotentialChangeRateUnits.MicrovoltsPerMicrosecond: return (value * 1E6) * 0.000001;
case ElectricPotentialChangeRateUnits.MillivoltsPerMicrosecond: return (value * 1E6) * 0.001;
case ElectricPotentialChangeRateUnits.KilovoltsPerMicrosecond: return (value * 1E6) * 1000;
case ElectricPotentialChangeRateUnits.MegavoltsPerMicrosecond: return (value * 1E6) * 1000000;
case ElectricPotentialChangeRateUnits.MicrovoltsPerMinute: return (value / 60) * 0.000001;
case ElectricPotentialChangeRateUnits.MillivoltsPerMinute: return (value / 60) * 0.001;
case ElectricPotentialChangeRateUnits.KilovoltsPerMinute: return (value / 60) * 1000;
case ElectricPotentialChangeRateUnits.MegavoltsPerMinute: return (value / 60) * 1000000;
case ElectricPotentialChangeRateUnits.MicrovoltsPerHour: return (value / 3600) * 0.000001;
case ElectricPotentialChangeRateUnits.MillivoltsPerHour: return (value / 3600) * 0.001;
case ElectricPotentialChangeRateUnits.KilovoltsPerHour: return (value / 3600) * 1000;
case ElectricPotentialChangeRateUnits.MegavoltsPerHour: return (value / 3600) * 1000000;
default: return Number.NaN;
}
}
/**
* Format the ElectricPotentialChangeRate to string.
* Note! the default format for ElectricPotentialChangeRate is VoltsPerSecond.
* To specify the unit format set the 'unit' parameter.
* @param unit The unit to format the ElectricPotentialChangeRate.
* @param options The ToString options, it also can be the number of fractional digits to keep that deprecated and moved to the options object. support in number will be dropped in the upcoming versions.
* @returns The string format of the ElectricPotentialChangeRate.
*/
toString(unit = ElectricPotentialChangeRateUnits.VoltsPerSecond, options) {
if (typeof options === 'number') {
console.warn('The number parameter is deprecated and moved to the options object. support in number will be dropped in the upcoming versions.');
options = { fractionalDigits: options };
}
switch (unit) {
case ElectricPotentialChangeRateUnits.VoltsPerSecond:
return super.truncateFractionDigits(this.VoltsPerSecond, options) + ` V/s`;
case ElectricPotentialChangeRateUnits.VoltsPerMicrosecond:
return super.truncateFractionDigits(this.VoltsPerMicrosecond, options) + ` V/μs`;
case ElectricPotentialChangeRateUnits.VoltsPerMinute:
return super.truncateFractionDigits(this.VoltsPerMinute, options) + ` V/min`;
case ElectricPotentialChangeRateUnits.VoltsPerHour:
return super.truncateFractionDigits(this.VoltsPerHour, options) + ` V/h`;
case ElectricPotentialChangeRateUnits.MicrovoltsPerSecond:
return super.truncateFractionDigits(this.MicrovoltsPerSecond, options) + ` μV/s`;
case ElectricPotentialChangeRateUnits.MillivoltsPerSecond:
return super.truncateFractionDigits(this.MillivoltsPerSecond, options) + ` mV/s`;
case ElectricPotentialChangeRateUnits.KilovoltsPerSecond:
return super.truncateFractionDigits(this.KilovoltsPerSecond, options) + ` kV/s`;
case ElectricPotentialChangeRateUnits.MegavoltsPerSecond:
return super.truncateFractionDigits(this.MegavoltsPerSecond, options) + ` MV/s`;
case ElectricPotentialChangeRateUnits.MicrovoltsPerMicrosecond:
return super.truncateFractionDigits(this.MicrovoltsPerMicrosecond, options) + ` μV/μs`;
case ElectricPotentialChangeRateUnits.MillivoltsPerMicrosecond:
return super.truncateFractionDigits(this.MillivoltsPerMicrosecond, options) + ` mV/μs`;
case ElectricPotentialChangeRateUnits.KilovoltsPerMicrosecond:
return super.truncateFractionDigits(this.KilovoltsPerMicrosecond, options) + ` kV/μs`;
case ElectricPotentialChangeRateUnits.MegavoltsPerMicrosecond:
return super.truncateFractionDigits(this.MegavoltsPerMicrosecond, options) + ` MV/μs`;
case ElectricPotentialChangeRateUnits.MicrovoltsPerMinute:
return super.truncateFractionDigits(this.MicrovoltsPerMinute, options) + ` μV/min`;
case ElectricPotentialChangeRateUnits.MillivoltsPerMinute:
return super.truncateFractionDigits(this.MillivoltsPerMinute, options) + ` mV/min`;
case ElectricPotentialChangeRateUnits.KilovoltsPerMinute:
return super.truncateFractionDigits(this.KilovoltsPerMinute, options) + ` kV/min`;
case ElectricPotentialChangeRateUnits.MegavoltsPerMinute:
return super.truncateFractionDigits(this.MegavoltsPerMinute, options) + ` MV/min`;
case ElectricPotentialChangeRateUnits.MicrovoltsPerHour:
return super.truncateFractionDigits(this.MicrovoltsPerHour, options) + ` μV/h`;
case ElectricPotentialChangeRateUnits.MillivoltsPerHour:
return super.truncateFractionDigits(this.MillivoltsPerHour, options) + ` mV/h`;
case ElectricPotentialChangeRateUnits.KilovoltsPerHour:
return super.truncateFractionDigits(this.KilovoltsPerHour, options) + ` kV/h`;
case ElectricPotentialChangeRateUnits.MegavoltsPerHour:
return super.truncateFractionDigits(this.MegavoltsPerHour, options) + ` MV/h`;
default:
break;
}
return this.value.toString();
}
/**
* Get ElectricPotentialChangeRate unit abbreviation.
* Note! the default abbreviation for ElectricPotentialChangeRate is VoltsPerSecond.
* To specify the unit abbreviation set the 'unitAbbreviation' parameter.
* @param unitAbbreviation The unit abbreviation of the ElectricPotentialChangeRate.
* @returns The abbreviation string of ElectricPotentialChangeRate.
*/
getUnitAbbreviation(unitAbbreviation = ElectricPotentialChangeRateUnits.VoltsPerSecond) {
switch (unitAbbreviation) {
case ElectricPotentialChangeRateUnits.VoltsPerSecond:
return `V/s`;
case ElectricPotentialChangeRateUnits.VoltsPerMicrosecond:
return `V/μs`;
case ElectricPotentialChangeRateUnits.VoltsPerMinute:
return `V/min`;
case ElectricPotentialChangeRateUnits.VoltsPerHour:
return `V/h`;
case ElectricPotentialChangeRateUnits.MicrovoltsPerSecond:
return `μV/s`;
case ElectricPotentialChangeRateUnits.MillivoltsPerSecond:
return `mV/s`;
case ElectricPotentialChangeRateUnits.KilovoltsPerSecond:
return `kV/s`;
case ElectricPotentialChangeRateUnits.MegavoltsPerSecond:
return `MV/s`;
case ElectricPotentialChangeRateUnits.MicrovoltsPerMicrosecond:
return `μV/μs`;
case ElectricPotentialChangeRateUnits.MillivoltsPerMicrosecond:
return `mV/μs`;
case ElectricPotentialChangeRateUnits.KilovoltsPerMicrosecond:
return `kV/μs`;
case ElectricPotentialChangeRateUnits.MegavoltsPerMicrosecond:
return `MV/μs`;
case ElectricPotentialChangeRateUnits.MicrovoltsPerMinute:
return `μV/min`;
case ElectricPotentialChangeRateUnits.MillivoltsPerMinute:
return `mV/min`;
case ElectricPotentialChangeRateUnits.KilovoltsPerMinute:
return `kV/min`;
case ElectricPotentialChangeRateUnits.MegavoltsPerMinute:
return `MV/min`;
case ElectricPotentialChangeRateUnits.MicrovoltsPerHour:
return `μV/h`;
case ElectricPotentialChangeRateUnits.MillivoltsPerHour:
return `mV/h`;
case ElectricPotentialChangeRateUnits.KilovoltsPerHour:
return `kV/h`;
case ElectricPotentialChangeRateUnits.MegavoltsPerHour:
return `MV/h`;
default:
break;
}
return '';
}
/**
* Check if the given ElectricPotentialChangeRate are equals to the current ElectricPotentialChangeRate.
* @param electricPotentialChangeRate The other ElectricPotentialChangeRate.
* @returns True if the given ElectricPotentialChangeRate are equal to the current ElectricPotentialChangeRate.
*/
equals(electricPotentialChangeRate) {
return super.internalEquals(this.value, electricPotentialChangeRate.BaseValue);
}
/**
* Compare the given ElectricPotentialChangeRate against the current ElectricPotentialChangeRate.
* @param electricPotentialChangeRate The other ElectricPotentialChangeRate.
* @returns 0 if they are equal, -1 if the current ElectricPotentialChangeRate is less then other, 1 if the current ElectricPotentialChangeRate is greater then other.
*/
compareTo(electricPotentialChangeRate) {
return super.internalCompareTo(this.value, electricPotentialChangeRate.BaseValue);
}
/**
* Add the given ElectricPotentialChangeRate with the current ElectricPotentialChangeRate.
* @param electricPotentialChangeRate The other ElectricPotentialChangeRate.
* @returns A new ElectricPotentialChangeRate instance with the results.
*/
add(electricPotentialChangeRate) {
return new ElectricPotentialChangeRate(super.internalAdd(this.value, electricPotentialChangeRate.BaseValue));
}
/**
* Subtract the given ElectricPotentialChangeRate with the current ElectricPotentialChangeRate.
* @param electricPotentialChangeRate The other ElectricPotentialChangeRate.
* @returns A new ElectricPotentialChangeRate instance with the results.
*/
subtract(electricPotentialChangeRate) {
return new ElectricPotentialChangeRate(super.internalSubtract(this.value, electricPotentialChangeRate.BaseValue));
}
/**
* Multiply the given ElectricPotentialChangeRate with the current ElectricPotentialChangeRate.
* @param electricPotentialChangeRate The other ElectricPotentialChangeRate.
* @returns A new ElectricPotentialChangeRate instance with the results.
*/
multiply(electricPotentialChangeRate) {
return new ElectricPotentialChangeRate(super.internalMultiply(this.value, electricPotentialChangeRate.BaseValue));
}
/**
* Divide the given ElectricPotentialChangeRate with the current ElectricPotentialChangeRate.
* @param electricPotentialChangeRate The other ElectricPotentialChangeRate.
* @returns A new ElectricPotentialChangeRate instance with the results.
*/
divide(electricPotentialChangeRate) {
return new ElectricPotentialChangeRate(super.internalDivide(this.value, electricPotentialChangeRate.BaseValue));
}
/**
* Modulo the given ElectricPotentialChangeRate with the current ElectricPotentialChangeRate.
* @param electricPotentialChangeRate The other ElectricPotentialChangeRate.
* @returns A new ElectricPotentialChangeRate instance with the results.
*/
modulo(electricPotentialChangeRate) {
return new ElectricPotentialChangeRate(super.internalModulo(this.value, electricPotentialChangeRate.BaseValue));
}
/**
* Pow the given ElectricPotentialChangeRate with the current ElectricPotentialChangeRate.
* @param electricPotentialChangeRate The other ElectricPotentialChangeRate.
* @returns A new ElectricPotentialChangeRate instance with the results.
*/
pow(electricPotentialChangeRate) {
return new ElectricPotentialChangeRate(super.internalPow(this.value, electricPotentialChangeRate.BaseValue));
}
}
exports.ElectricPotentialChangeRate = ElectricPotentialChangeRate;