'use strict'; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } /** * Licensed Materials - Property of IBM * IBM Business Analytics (C) Copyright IBM Corp. 2020 * US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp. */ define(['underscore'], function (_) { // implements IValue var VIPRValue = function () { function VIPRValue(valueObj, formatter, resultItemIndex) { _classCallCheck(this, VIPRValue); //accept either { .v or # } this.rawValue = valueObj; this.value = valueObj && !_.isNumber(valueObj) && valueObj.v !== undefined ? valueObj.v : valueObj; this.formatter = formatter; this.index = resultItemIndex; } VIPRValue.prototype.getIndex = function getIndex() { return this.index; }; VIPRValue.prototype.getValue = function getValue() { //The value of a VIPRValue is a number (eg 1234.50) return this.value; }; VIPRValue.prototype.getValueType = function getValueType() { if (this.value === null) { return 'missing'; //NULL Value support, to be parsed by VIDA } return 'numeric'; //Default Value Type }; VIPRValue.prototype.getCaption = function getCaption() { //The "caption" of a value is its formatted string (eg: $1,234.50) return this.formatter ? this.formatter.format(this.value) : this.value; }; /** * This function is not an implementation of IValue * Sole purpose is to give VIPREventTarget to have access to the raw datapoint value */ VIPRValue.prototype.getRawValue = function getRawValue() { return this.rawValue; }; return VIPRValue; }(); return VIPRValue; }); //# sourceMappingURL=VIPRValue.js.map