mirror of
https://github.com/nasa/openmct.git
synced 2025-06-18 23:28:14 +00:00
[Code Style] Use prototypes in telemetry bundle
WTD-1482
This commit is contained in:
@ -39,41 +39,35 @@ define(
|
||||
* @constructor
|
||||
*/
|
||||
function TelemetryFormatter() {
|
||||
function formatDomainValue(v, key) {
|
||||
return isNaN(v) ? "" : moment.utc(v).format(DATE_FORMAT);
|
||||
}
|
||||
|
||||
function formatRangeValue(v, key) {
|
||||
return isNaN(v) ? v : v.toFixed(3);
|
||||
}
|
||||
|
||||
return {
|
||||
/**
|
||||
* Format a domain value.
|
||||
* @param {number} v the domain value; a timestamp
|
||||
* in milliseconds since start of 1970
|
||||
* @param {string} [key] the key which identifies the
|
||||
* domain; if unspecified or unknown, this will
|
||||
* be treated as a standard timestamp.
|
||||
* @returns {string} a textual representation of the
|
||||
* data and time, suitable for display.
|
||||
* @memberof platform/telemetry.TelemetryFormatter#
|
||||
*/
|
||||
formatDomainValue: formatDomainValue,
|
||||
/**
|
||||
* Format a range value.
|
||||
* @param {number} v the range value; a numeric value
|
||||
* @param {string} [key] the key which identifies the
|
||||
* range; if unspecified or unknown, this will
|
||||
* be treated as a numeric value.
|
||||
* @returns {string} a textual representation of the
|
||||
* value, suitable for display.
|
||||
* @memberof platform/telemetry.TelemetryFormatter#
|
||||
*/
|
||||
formatRangeValue: formatRangeValue
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a domain value.
|
||||
* @param {number} v the domain value; a timestamp
|
||||
* in milliseconds since start of 1970
|
||||
* @param {string} [key] the key which identifies the
|
||||
* domain; if unspecified or unknown, this will
|
||||
* be treated as a standard timestamp.
|
||||
* @returns {string} a textual representation of the
|
||||
* data and time, suitable for display.
|
||||
*/
|
||||
TelemetryFormatter.prototype.formatDomainValue = function (v, key) {
|
||||
return isNaN(v) ? "" : moment.utc(v).format(DATE_FORMAT);
|
||||
};
|
||||
|
||||
/**
|
||||
* Format a range value.
|
||||
* @param {number} v the range value; a numeric value
|
||||
* @param {string} [key] the key which identifies the
|
||||
* range; if unspecified or unknown, this will
|
||||
* be treated as a numeric value.
|
||||
* @returns {string} a textual representation of the
|
||||
* value, suitable for display.
|
||||
*/
|
||||
TelemetryFormatter.prototype.formatRangeValue = function (v, key) {
|
||||
return isNaN(v) ? String(v) : v.toFixed(VALUE_FORMAT_DIGITS);
|
||||
};
|
||||
|
||||
return TelemetryFormatter;
|
||||
}
|
||||
);
|
||||
|
Reference in New Issue
Block a user