Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
//deserialize.js
/*global adventurejs A*/

/**
 * Reverses serialize function. <ul><li>convert '_' to ' '</li><li>convert '&' to ' and '</li><li>convert '$' to '.'</li></ul>
 * @method adventurejs#deserialize
 * @memberOf adventurejs
 * @param {String} name
 * @returns {String}
 */
adventurejs.deserialize = function Adventurejs_deserialize(name) {
  if ("string" !== typeof name) return "";
  return name
    .replace(/&/g, " and ")
    .replace(/_/g, " ")
    .replace(/\$/g, ".")
    .toLowerCase();
};