UNPKG

antd

Version:

An enterprise-class UI design language and React components implementation

67 lines 1.88 kB
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; import _createClass from "@babel/runtime/helpers/esm/createClass"; import _callSuper from "@babel/runtime/helpers/esm/callSuper"; import _inherits from "@babel/runtime/helpers/esm/inherits"; import AbstractCalculator from './calculator'; let NumCalculator = /*#__PURE__*/function (_AbstractCalculator) { function NumCalculator(num) { var _this; _classCallCheck(this, NumCalculator); _this = _callSuper(this, NumCalculator); _this.result = 0; if (num instanceof NumCalculator) { _this.result = num.result; } else if (typeof num === 'number') { _this.result = num; } return _this; } _inherits(NumCalculator, _AbstractCalculator); return _createClass(NumCalculator, [{ key: "add", value: function add(num) { if (num instanceof NumCalculator) { this.result += num.result; } else if (typeof num === 'number') { this.result += num; } return this; } }, { key: "sub", value: function sub(num) { if (num instanceof NumCalculator) { this.result -= num.result; } else if (typeof num === 'number') { this.result -= num; } return this; } }, { key: "mul", value: function mul(num) { if (num instanceof NumCalculator) { this.result *= num.result; } else if (typeof num === 'number') { this.result *= num; } return this; } }, { key: "div", value: function div(num) { if (num instanceof NumCalculator) { this.result /= num.result; } else if (typeof num === 'number') { this.result /= num; } return this; } }, { key: "equal", value: function equal() { return this.result; } }]); }(AbstractCalculator); export { NumCalculator as default };