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

/**
 * Convert an arbitrary string to an id useable by game objects.
 * Converts to lowercase and converts ' ' to '_'.
 * @method adventurejs#normalize
 * @memberOf adventurejs
 * @param {String} name
 * @returns {String}
 */
adventurejs.normalize = function Adventurejs_normalize(name) {
  if ("string" !== typeof name) return "";
  // return name.replace(/ /g, "_").replace(/\./g, "$").toLowerCase();
  return name.replace(/ /g, "_").toLowerCase();
};