Skip to content

Commit

Permalink
Use Symbol for object hash when possible
Browse files Browse the repository at this point in the history
  • Loading branch information
leebyron committed Aug 26, 2014
1 parent 74854a4 commit bbd9784
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 19 deletions.
5 changes: 4 additions & 1 deletion dist/Immutable.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function invariant(condition, error) {
throw new Error(error);
}
var DELETE = 'delete';
var ITERATOR = typeof Symbol === 'undefined' ? '@@iterator' : Symbol.iterator;
var ITERATOR = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator';
function hash(o) {
if (!o) {
return 0;
Expand Down Expand Up @@ -150,6 +150,9 @@ function hashJSObj(obj) {
var HASH_MAX_VAL = 0x7FFFFFFF;
var UID_HASH_COUNT = 0;
var UID_HASH_KEY = '__immutablehash__';
if (typeof Symbol !== 'undefined') {
UID_HASH_KEY = Symbol(UID_HASH_KEY);
}
var isIE8 = false;
var STRING_HASH_CACHE_MIN_STRLEN = 16;
var STRING_HASH_CACHE_MAX_SIZE = 255;
Expand Down

0 comments on commit bbd9784

Please sign in to comment.