bit-bin
Version:
<a href="https://opensource.org/licenses/Apache-2.0"><img alt="apache" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a> <a href="https://github.com/teambit/bit/blob/master/CONTRIBUTING.md"><img alt="prs" src="https://img.shields.io/b
105 lines (82 loc) • 2.45 kB
JavaScript
;
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
function _bluebird() {
const data = require("bluebird");
_bluebird = function () {
return data;
};
return data;
}
function _defineProperty2() {
const data = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
_defineProperty2 = function () {
return data;
};
return data;
}
class Diagnosis {
constructor() {
(0, _defineProperty2().default)(this, "name", void 0);
(0, _defineProperty2().default)(this, "description", void 0);
(0, _defineProperty2().default)(this, "category", void 0);
(0, _defineProperty2().default)(this, "result", void 0);
}
/**
* A function that actually runs the examination
*/
_runExamine() {
return (0, _bluebird().coroutine)(function* () {
throw new Error('You must implement this method');
})();
}
/**
* Returns a descriptive symptoms message which might include specific data from the examination
* @param bareResult ExamineBareResult
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_formatSymptoms(bareResult) {
throw new Error('You must implement this method');
}
/**
* Returns a descriptive instruction to handle the issue (might include specific data from the examination)
* @param bareResult ExamineBareResult
*/
// eslint-disable-next-line @typescript-eslint/no-unused-vars
_formatManualTreat(bareResult) {
throw new Error('You must implement this method');
}
getMeta() {
return {
category: this.category,
name: this.name,
description: this.description
};
}
examine() {
var _this = this;
return (0, _bluebird().coroutine)(function* () {
const bareResult = yield _this._runExamine();
if (bareResult.valid) {
return {
diagnosisMetaData: _this.getMeta(),
bareResult,
formattedSymptoms: '',
formattedManualTreat: ''
};
}
const formattedSymptoms = _this._formatSymptoms(bareResult);
const formattedManualTreat = _this._formatManualTreat(bareResult);
return {
diagnosisMetaData: _this.getMeta(),
bareResult,
formattedSymptoms,
formattedManualTreat
};
})();
}
}
exports.default = Diagnosis;