Pre-release
AdventureJS Docs Downloads
Score: 0 Moves: 0
// obfuscate.js

/* global adventurejs A */

/**
 * Obfuscate a string. Used to make saved game files
 * non human readable via a simple character shift.
 * @method adventurejs.Game#obfuscate
 * @memberOf adventurejs.Game
 * @param {String} text
 * @returns {String}
 */
adventurejs.obfuscate = function Adventurejs_obfuscate(text) {
  return Array.from(text)
    .map((c) => String.fromCharCode(c.charCodeAt(0) + 3))
    .join("");
};