'use strict';

function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }

var isNum = _interopDefault(require('./isNum'));

/**
 * 超出限定数值显示加号
 * @param {number} value 传入数值
 * @param {number} maxNum 限定数值，默认: 99
 * @returns {string}
 *
 * @example
 * outOfNumShowPlus(10);     // => '10'
 * outOfNumShowPlus(10, 9);  // => '9+'
 * outOfNumShowPlus(100);    // => '99+'
 */
function outOfNumShowPlus(value, maxNum) {
  value = isNum(+String(value)) ? value : '';
  if (!isNum(maxNum)) maxNum = 99;
  return value > maxNum ? "".concat(maxNum, "+") : String(value);
}

module.exports = outOfNumShowPlus;
