maycur-business
Version:
maycur business react components of web
34 lines (24 loc) • 1 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = subtract;
var _isnumber = _interopRequireDefault(require("./isnumber"));
var _error = require("./error");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
// Copyright 2015-2018 FormBucket LLC
// SUBTRACT calculates the difference of two numbers.
function subtract() {
var a = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
var b = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
// Return `#NA!` if 2 arguments are not provided.
var copyA = a === null ? 0 : a;
var copyB = b === null ? 0 : b;
if (arguments.length !== 2) {
return _error.ERRORTYPES.na;
} // Return `#VALUE!` if either a or b is not a number.
if (!(0, _isnumber["default"])(copyA) || !(0, _isnumber["default"])(copyB)) {
return _error.ERRORTYPES.value;
} // Return the difference.
return copyA - copyB;
}