text: 'use strict';
  
  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  
  var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
  
  exports.default = fileSizeFormatter;
  /**
   * Copyright (c) 2015-present, Zippy Technologies
   *
   * This source code is licensed under the MIT license found in the
   * LICENSE file in the root directory of this source tree.
   */
  
  var formatNumber = function formatNumber(number, locale) {
    return number.toLocaleString(locale, {
      maximumFractionDigits: 2
    });
  };
  
  var defaultProps = {
    gbSingular: 'GB',
    gbPlural: 'GBs',
    mbSingular: 'MB',
    mbPlural: 'MBs',
    kbSingular: 'KB',
    kbPlural: 'KBs',
    byteSingular: 'B',
    bytePlural: 'Bs',
    formatNumber: formatNumber
  };
  
  var KB = 1024;
  var MB = 1024 * KB;
  var GB = 1024 * MB;
  
  function fileSizeFormatter() {
    var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
    var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  
    var _defaultProps$config = _extends({}, defaultProps, config),
        gbSingular = _defaultProps$config.gbSingular,
        gbPlural = _defaultProps$config.gbPlural,
        mbSingular = _defaultProps$config.mbSingular,
        mbPlural = _defaultProps$config.mbPlural,
        kbSingular = _defaultProps$config.kbSingular,
        kbPlural = _defaultProps$config.kbPlural,
        byteSingular = _defaultProps$config.byteSingular,
        bytePlural = _defaultProps$config.bytePlural,
        formatNumber = _defaultProps$config.formatNumber,
        locale = _defaultProps$config.locale;
  
    var isByte = size === 0 || size === 1;
    var isBytes = size < KB;
    var isKByte = size === KB;
    var isKBytes = size < MB;
    var isMB = size === MB;
    var isMBs = size < GB;
    var isGByte = size === GB;
    var isGBytes = size > GB;
  
    var suffix = void 0;
  
    if (isByte) {
      suffix = byteSingular;
    } else if (isBytes) {
      suffix = bytePlural;
    } else if (isKByte) {
      suffix = kbSingular;
      size = size / KB;
    } else if (isKBytes) {
      suffix = kbPlural;
      size = size / KB;
    } else if (isMB) {
      suffix = mbSingular;
      size = size / MB;
    } else if (isMBs) {
      suffix = mbPlural;
      size = size / MB;
    } else if (isGByte) {
      suffix = gbSingular;
      size = size / GB;
    } else if (isGBytes) {
      suffix = gbPlural;
      size = size / GB;
    }
  
    return '' + formatNumber(size, locale) + suffix;
  }
  
  exports.formatNumber = formatNumber;