'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});

var _constants = require('./constants');

var _isRomaji = require('./isRomaji');

var _isRomaji2 = _interopRequireDefault(_isRomaji);

var _isMixed = require('./isMixed');

var _isMixed2 = _interopRequireDefault(_isMixed);

var _hiraganaToKatakana = require('./utils/hiraganaToKatakana');

var _hiraganaToKatakana2 = _interopRequireDefault(_hiraganaToKatakana);

var _romajiToHiragana = require('./utils/romajiToHiragana');

var _romajiToHiragana2 = _interopRequireDefault(_romajiToHiragana);

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Convert input to [Katakana](https://en.wikipedia.org/wiki/Katakana)
 * @param  {String} [input=''] text
 * @param  {DefaultOptions} [options=defaultOptions]
 * @return {String} converted text
 * @example
 * toKatakana('toukyou, おおさか')
 * // => 'トウキョウ、　オオサカ'
 * toKatakana('only かな', { passRomaji: true })
 * // => 'only カナ'
 * toKatakana('wi')
 * // => 'ウィ'
 * toKatakana('wi', { useObsoleteKana: true })
 * // => 'ヰ'
*/
function toKatakana() {
  var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

  var config = Object.assign({}, _constants.DEFAULT_OPTIONS, options);
  if (config.passRomaji) return (0, _hiraganaToKatakana2.default)(input);
  if ((0, _isRomaji2.default)(input) || (0, _isMixed2.default)(input)) {
    var romaji = (0, _romajiToHiragana2.default)(input, config);
    return (0, _hiraganaToKatakana2.default)(romaji);
  }
  return (0, _hiraganaToKatakana2.default)(input);
}

exports.default = toKatakana;