UNPKG

@twurple/eventsub-base

Version:

Base for the other Twurple EventSub packages

44 lines (43 loc) 1.84 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.EventSubChannelCharityAmount = void 0; const tslib_1 = require("tslib"); const common_1 = require("@twurple/common"); /** * An object representing monetary amount and currency information for charity donations/goals. */ let EventSubChannelCharityAmount = class EventSubChannelCharityAmount extends common_1.DataObject { /** * The monetary amount. The amount is specified in the currency’s minor unit. * For example, the minor units for USD is cents, so if the amount is $5.50 USD, `value` is set to 550. */ get value() { return this[common_1.rawDataSymbol].value; } /** * The number of decimal places used by the currency. For example, USD uses two decimal places. * Use this number to translate `value` from minor units to major units by using the formula: * * `value / 10^decimalPlaces` */ get decimalPlaces() { return this[common_1.rawDataSymbol].decimal_places; } /** * The localized monetary amount based on the value and the decimal places of the currency. * For example, the minor units for USD is cents which uses two decimal places, so if `value` is 550, `localizedValue` is set to 5.50. */ get localizedValue() { return this.value / 10 ** this.decimalPlaces; } /** * The ISO-4217 three-letter currency code that identifies the type of currency in `value`. */ get currency() { return this[common_1.rawDataSymbol].currency; } }; exports.EventSubChannelCharityAmount = EventSubChannelCharityAmount; exports.EventSubChannelCharityAmount = EventSubChannelCharityAmount = tslib_1.__decorate([ (0, common_1.rtfm)('eventsub-base', 'EventSubChannelCharityAmount') ], EventSubChannelCharityAmount);