'use strict';

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

var _isKanji = require('./isKanji');

var _isKanji2 = _interopRequireDefault(_isKanji);

var _isHiragana = require('./isHiragana');

var _isHiragana2 = _interopRequireDefault(_isHiragana);

var _isKatakana = require('./isKatakana');

var _isKatakana2 = _interopRequireDefault(_isKatakana);

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

var _isRomaji2 = _interopRequireDefault(_isRomaji);

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

function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

/**
 * Test if `input` contains a mix of [Romaji](https://en.wikipedia.org/wiki/Romaji) *and* [Kana](https://en.wikipedia.org/wiki/Kana), defaults to pass through [Kanji](https://en.wikipedia.org/wiki/Kanji)
 * @param  {String} input text
 * @param  {Object} [options={ passKanji: true }] optional config to pass through kanji
 * @return {Boolean} true if mixed
 * @example
 * isMixed('Abあア'))
 * // => true
 * isMixed('お腹A'))
 * // => true
 * isMixed('お腹A', { passKanji: false }))
 * // => false
 * isMixed('ab'))
 * // => false
 * isMixed('あア'))
 * // => false
 */
function isMixed() {
  var input = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
  var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : { passKanji: true };

  var chars = [].concat(_toConsumableArray(input));
  var hasKanji = false;
  if (!options.passKanji) {
    hasKanji = chars.some(_isKanji2.default);
  }
  return (chars.some(_isHiragana2.default) || chars.some(_isKatakana2.default)) && chars.some(_isRomaji2.default) && !hasKanji;
}

exports.default = isMixed;