Skip to content

Instantly share code, notes, and snippets.

@skopp
Created June 8, 2013 03:06
Show Gist options
  • Save skopp/5733836 to your computer and use it in GitHub Desktop.
Save skopp/5733836 to your computer and use it in GitHub Desktop.
hash function script
var hash = function hashFunction( val ) {
switch( typeof val ) {
case "number":
if( ( val | 0 ) === val ) {
return val & 0x3fffffff;
}
return hashNumber( val );
case "string":
return hashString( val );
case "boolean":
return hashBoolean( val );
default:
return hashObject( val );
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment