Ensure cacheIndexOf works correctly with boolean values.

Former-commit-id: 21f65952b14ddfff892a8c151545ad807a8ec9ef
This commit is contained in:
John-David Dalton
2013-08-25 01:39:18 -07:00
parent 2969290c63
commit d47cac563a
6 changed files with 27 additions and 16 deletions

View File

@@ -179,17 +179,17 @@
cache = cache.cache;
if (type == 'boolean' || value == null) {
return cache[value];
return cache[value] ? 0 : -1;
}
if (type != 'number' && type != 'string') {
type = 'object';
}
var key = type == 'number' ? value : keyPrefix + value;
cache = cache[type] || (cache[type] = {});
cache = (cache = cache[type]) && cache[key];
return type == 'object'
? (cache[key] && baseIndexOf(cache[key], value) > -1 ? 0 : -1)
: (cache[key] ? 0 : -1);
? (cache && baseIndexOf(cache, value) > -1 ? 0 : -1)
: (cache ? 0 : -1);
}
/**