Liferay.Loader.define("portal-workflow-metrics-web@2.0.46/js/shared/util/util.es", ['module', 'exports', 'require', './numeral.es'], function (module, exports, require) {
  var define = undefined;
  var global = window;
  {
    Object.defineProperty(exports, "__esModule", {
      value: true
    });
    exports.toUppercase = exports.isValidNumber = exports.getPercentage = exports.getFormattedPercentage = exports.capitalize = void 0;

    var _numeral = require("./numeral.es");

    /**
     * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
     *
     * The contents of this file are subject to the terms of the Liferay Enterprise
     * Subscription License ("License"). You may not use this file except in
     * compliance with the License. You can obtain a copy of the License by
     * contacting Liferay, Inc. See the License for the specific language governing
     * permissions and limitations under the License, including but not limited to
     * distribution rights of the Software.
     */

    /**
     * Return true if number is valid
     * @param {number} number
     */
    var isValidNumber = function isValidNumber(number) {
      return !isNaN(number) && number !== Infinity ? true : false;
    };
    /**
     * Returns the percent number passing as
     * parameter the current number and total number.
     * @param {number} number1
     * @param {number} number2
     * @returns {number}
     */

    exports.isValidNumber = isValidNumber;

    var getPercentage = function getPercentage(number1, number2) {
      var result = number1 / number2;
      return isValidNumber(result) ? result : 0;
    };
    /**
     * Returns the formatted percent number passing as
     * parameter the current number and total number.
     * @param {number} number1
     * @param {number} number2
     * @returns {number}
     */

    exports.getPercentage = getPercentage;

    var getFormattedPercentage = function getFormattedPercentage(number1, number2) {
      var percentage = getPercentage(number1, number2);
      return (0, _numeral.formatNumber)(percentage, '0[.]00%');
    };

    exports.getFormattedPercentage = getFormattedPercentage;

    var capitalize = function capitalize(str) {
      return str.replace(/^\w/, function (letter) {
        return letter.toUpperCase();
      });
    };

    exports.capitalize = capitalize;

    var toUppercase = function toUppercase(str) {
      return str && str.length ? str.toUpperCase() : str;
    };

    exports.toUppercase = toUppercase;
    //# sourceMappingURL=util.es.js.map
  }
});
//# sourceMappingURL=util.es.js.map