aboutsummaryrefslogtreecommitdiffstats
path: root/src/apis.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/apis.js')
-rw-r--r--src/apis.js10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/apis.js b/src/apis.js
index 6f9b1d0a..7b470802 100644
--- a/src/apis.js
+++ b/src/apis.js
@@ -14,16 +14,20 @@
* The resulting string key is in 'type:hashKey' format.
*/
function hashKey(obj) {
- var objType = typeof obj;
- var key = obj;
- if (objType == 'object') {
+ var objType = typeof obj,
+ key;
+
+ if (objType == 'object' && obj !== null) {
if (typeof (key = obj.$$hashKey) == 'function') {
// must invoke on object to keep the right this
key = obj.$$hashKey();
} else if (key === undefined) {
key = obj.$$hashKey = nextUid();
}
+ } else {
+ key = obj;
}
+
return objType + ':' + key;
}