1
0
mirror of https://github.com/chylex/objtree.git synced 2025-04-29 11:34:08 +02:00

Fix single letter key names being put in []

This commit is contained in:
chylex 2017-07-24 12:16:20 +02:00
parent 09de177735
commit 9f984a3181
2 changed files with 3 additions and 3 deletions

View File

@ -74,8 +74,8 @@ OBJECT TREE
|-- [var] testObject['testSpecial-Name!'] > (null)
|-- [fun] testClass()
|-- testClass.prototype
|-- [fun] testClass.prototype['a']()
|-- [fun] testClass.prototype['b']()
|-- [fun] testClass.prototype.a()
|-- [fun] testClass.prototype.b()
|-- [var] testClass.CONSTANT > true
|-- [var] testClass.data > 10
|-- [fun] testFunction(a, b, c)

View File

@ -131,7 +131,7 @@
return v === 0 ? +(entry1[0] > entry2[0]) : v;
};
var keyRegex = /^[a-z_$][a-z0-9_$]+$/i;
var keyRegex = /^[a-z_$][a-z0-9_$]*$/i;
var getKeyAccess = function(key){
return keyRegex.test(key) ? "."+key : "['"+key+"']";