@kyi193/kevins-thought-machine
Version:
Randomly return an answer for a yes or no question
56 lines (47 loc) • 2.39 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = void 0;
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
var IfThisHeightResponse = /*#__PURE__*/function () {
function IfThisHeightResponse() {
_classCallCheck(this, IfThisHeightResponse);
this.feet = [3, 4, 5, 6, 7];
this.inches = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1.5, 2.5, 3.5, 4.5, 5.5, 6.5, 7.5, 8.5, 9.5, 10.5, 11.5];
this.tallerOrShorter = ['taller', 'shorter'];
this.randomFeet;
this.randomInches;
this.randomTallerOrShorter;
}
_createClass(IfThisHeightResponse, [{
key: "getAnswer",
value: function getAnswer() {
var randomFeetIdx = Math.floor(Math.random() * this.feet.length);
var randomFeet = this.feet[randomFeetIdx];
var randomInchesIdx = Math.floor(Math.random() * this.inches.length);
var randomInches = this.inches[randomInchesIdx];
var randomTallerOrShorterIdx = Math.floor(Math.random() * this.tallerOrShorter.length);
var randomTallerOrShorter = this.tallerOrShorter[randomTallerOrShorterIdx];
this.randomFeet = randomFeet;
this.randomInches = randomInches;
this.randomTallerOrShorter = randomTallerOrShorter;
return "If you're ".concat(randomTallerOrShorter, " than ").concat(randomFeet, "'").concat(randomInches, "\", then absolutely");
}
}, {
key: "getResults",
value: function getResults() {
return {
answer: this.getAnswer(),
index: 8,
randomFeet: this.randomFeet,
randomInches: this.randomInches,
randomTallerOrShorter: this.randomTallerOrShorter
};
}
}]);
return IfThisHeightResponse;
}();
exports["default"] = IfThisHeightResponse;