UNPKG

antd

Version:

An enterprise-class UI design language and React components implementation

71 lines 2.3 kB
import _classCallCheck from "@babel/runtime/helpers/esm/classCallCheck"; import _createClass from "@babel/runtime/helpers/esm/createClass"; import _possibleConstructorReturn from "@babel/runtime/helpers/esm/possibleConstructorReturn"; import _isNativeReflectConstruct from "@babel/runtime/helpers/esm/isNativeReflectConstruct"; import _getPrototypeOf from "@babel/runtime/helpers/esm/getPrototypeOf"; import _inherits from "@babel/runtime/helpers/esm/inherits"; function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); } import AbstractCalculator from './calculator'; let NumCalculator = /*#__PURE__*/function (_AbstractCalculator) { _inherits(NumCalculator, _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; } _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; } }]); return NumCalculator; }(AbstractCalculator); export { NumCalculator as default };