UNPKG

clean-insights-sdk

Version:

A privacy-preserving measurement framework.

34 lines (33 loc) 1.44 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.DataPoint = void 0; var dayjs_1 = __importDefault(require("dayjs")); var DataPoint = /** @class */ (function () { /** * @param {string} campaignId * The campaign ID this data point is for. * * @param {number=} times=1 * Number of times this data point has arisen between `first` and `last`. OPTIONAL. * * @param {dayjs.Dayjs=} first=NOW * The first time this data point has arisen. OPTIONAL. * * @param {dayjs.Dayjs=} last=NOW * The last time this data point has arisen. OPTIONAL. */ function DataPoint(campaignId, times, first, last) { this.campaignId = campaignId; this.times = typeof times === 'number' ? times : 1; this.first = first ? (0, dayjs_1.default)(first) : (0, dayjs_1.default)(); this.last = last ? (0, dayjs_1.default)(last) : (0, dayjs_1.default)(); } DataPoint.prototype.toString = function () { return "[".concat(this.constructor.name, ": campaignId=").concat(this.campaignId, ", times=").concat(this.times, ", first=").concat(this.first.format(), ", last=").concat(this.last.format(), "]"); }; return DataPoint; }()); exports.DataPoint = DataPoint;