code: function escapestr(s) {
              return s.replace(/\\/g, '\\\\')
                      .replace(/'/g, '\\\'')
                      .replace(/"/g, '\\"')
                      .replace(/\r/g, '\\r')
                      .replace(/\n/g, '\\n');
          }
docs: Escaoes a string to be used inside of a single or double quote enclosed JavaScript string.
  @function escapestr
  @param {string} s String to escape
  @returns {string} Escaped string