src/entitykeys.js
function(str) {
  // Check for empty string
  if (str === '') {
    return '!';
  }
  // 1. URL encode
  // 2. URL encode all exclamation marks (replace ! with %21)
  // 3. URL encode all tilde (replace ~ with %7e)
  //    This ensures that when using ~ as separator in CompositeKey we can
  //    do prefix matching
  // 4. Replace % with exclamation marks for Azure compatibility
  return encodeURIComponent(str)
    .replace(/!/g, '%21')
    .replace(/~/g, '%7e')
    .replace(/%/g, '!');
}
function(str) {
  // Check for empty string
  if (str === '') {
    return '!';
  }
  // 1. URL encode
  // 2. URL encode all exclamation marks (replace ! with %21)
  // 3. URL encode all tilde (replace ~ with %7e)
  //    This ensures that when using ~ as separator in CompositeKey we can
  //    do prefix matching
  // 4. Replace % with exclamation marks for Azure compatibility
  return encodeURIComponent(str)
    .replace(/!/g, '%21')
    .replace(/~/g, '%7e')
    .replace(/%/g, '!');
}
function ( str ) { // Check for empty string if ( str === '' ) { return '!' ; } // 1. URL encode // 2. URL encode all exclamation marks (replace ! with %21) // 3. URL encode all tilde (replace ~ with %7e) //    This ensures that when using ~ as separator in CompositeKey we can //    do prefix matching // 4. Replace % with exclamation marks for Azure compatibility return encodeURIComponent ( str ) . replace ( / ! / g , '%21' ) . replace ( / ~ / g , '%7e' ) . replace ( / % / g , '!' ) ; }
Encode string-key, to escape characters for Azure Table Storage and replace
empty strings with a single '!', so that empty strings can be allowed.
Encode string - key to escape characters for Azure Table Storage and replace empty strings with a single ! so that empty strings can be allowed .