Created
June 8, 2013 03:06
-
-
Save skopp/5733836 to your computer and use it in GitHub Desktop.
hash function script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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