Mnemonic = function(data, wordlist) {
  if (!(this instanceof Mnemonic)) {
    return new Mnemonic(data, wordlist);
  }

  if (_.isArray(data)) {
    wordlist = data;
    data = null;
  }


  // handle data overloading
  var ent, phrase, seed;
  if (Buffer.isBuffer(data)) {
    seed = data;
    ent = seed.length * 8;
  } else if (_.isString(data)) {
    phrase = unorm.nfkd(data);
  } else if (_.isNumber(data)) {
    ent = data;
  } else if (data) {
    throw new bitcore.errors.InvalidArgument('data', 'Must be a Buffer, a string or an integer');
  }
  ent = ent || 128;


  // check and detect wordlist
  wordlist = wordlist || Mnemonic._getDictionary(phrase);
  if (phrase && !wordlist) {
    throw new errors.UnknownWordlist(phrase);
  }
  wordlist = wordlist || Mnemonic.Words.ENGLISH;

  if (seed) {
    phrase = Mnemonic._entropy2mnemonic(seed, wordlist);
  }


  // validate phrase and ent
  if (phrase && !Mnemonic.isValid(phrase, wordlist)) {
    throw new errors.InvalidMnemonic(phrase);
  }
  if (ent % 32 !== 0 || ent < 128 || ent > 256) {
    throw new bitcore.errors.InvalidArgument('ENT', 'Values must be ENT > 128 and ENT < 256 and ENT % 32 == 0');
  }

  phrase = phrase || Mnemonic._mnemonic(ent, wordlist);

  // this fixes spacing in JP
  phrase = unorm.nfkd(phrase);

  Object.defineProperty(this, 'wordlist', {
    configurable: false,
    value: wordlist
  });

  Object.defineProperty(this, 'phrase', {
    configurable: false,
    value: phrase
  });
}
This is an immutable class that represents a BIP39 Mnemonic code.
See BIP39 specification for more info: https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki
A Mnemonic code is a a group of easy to remember words used for the generation
of deterministic wallets. A Mnemonic can be used to generate a seed using
an optional passphrase, for later generate a HDPrivateKey.

@example
// generate a random mnemonic
var mnemonic = new Mnemonic();
var phrase = mnemonic.phrase;

// use a different language
var mnemonic = new Mnemonic(Mnemonic.Words.SPANISH);
var xprivkey = mnemonic.toHDPrivateKey();

@param {*=} data - a seed, phrase, or entropy to initialize (can be skipped)
@param {Array=} wordlist - the wordlist to generate mnemonics from
@returns {Mnemonic} A new instance of Mnemonic
@constructor