Skip to content

Instantly share code, notes, and snippets.

@lennerd
Created February 19, 2013 09:39
Show Gist options
  • Save lennerd/4984422 to your computer and use it in GitHub Desktop.
Save lennerd/4984422 to your computer and use it in GitHub Desktop.
A way to hash JavaScript objects.
(function() {
var lastStorageId = 0;
this.Object.hash = function(object) {
var hash = object.__id;
if (hash === undefined)
hash = object.__id = lastStorageId++;
return '#' + hash;
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment