var translate = require('@k3rn31p4nic/google-translate-api');

/**
 * Translation module
 *
 * @param {string} string string
 * @param {object} [options = { to = 'en'}] Option (default: { from = 'auto', to = 'en', raw = false })
 * @return {object} JSON (async function)
 *
 * @example
 * var snu = require('s-node-utils');
 *
 * (async () => {
 *   console.log(
 *     await snu.string.translate("Salut, comment sa va ?", { to: "en" })
 *   );
 * })();
 * //=> { text: 'Hi, how are you?',
 * //=>   from:
 * //=>     { language: { didYouMean: false, iso: 'fr' },
 * //=>       text:
 * //=>         { autoCorrected: false,
 * //=>           value: 'Salut, comment [ça] va ?',
 * //=>           didYouMean: true } },
 * //=>   raw: '' }
 */
module.exports = async function(string, options) {
  let final = await translate(string, options);
  return final;
};
