@splode/obake
Version:
Check merchants for deals.
30 lines • 1.27 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
var chalk_1 = __importDefault(require("chalk"));
var strings_1 = require("../strings");
var Good = /** @class */ (function () {
function Good(good) {
this.merchant = null;
this.URL = good.URL;
this.name = good.name;
this.price = good.price;
this.disabled = good.disabled || false;
}
Good.prototype.getDiscountText = function (price) {
return "found " + (0, strings_1.prettyPercent)(price, this.price) + " off strike price " + this.name + ": " + this.URL;
};
Good.prototype.getFoundPriceText = function (price) {
var _a;
var ps = chalk_1.default.cyan("" + price.toFixed(2));
return "found price " + ps + " for " + this.name + " at " + ((_a = this.merchant) === null || _a === void 0 ? void 0 : _a.prettyName);
};
Good.prototype.getNotFoundPriceText = function () {
return "unable to find price data for " + this.name + ": " + this.URL;
};
return Good;
}());
exports.default = Good;
//# sourceMappingURL=Good.js.map