UNPKG

maycur-business

Version:

maycur business react components of web

34 lines (24 loc) 991 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = add; var _isnumber = _interopRequireDefault(require("./isnumber")); var _error = require("./error"); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } // Copyright 2015-2018 FormBucket LLC // ADD calculates the sum of two numbers. function add() { 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 sum. return Number(copyA) + Number(copyB); }