mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
parent
071a04595a
commit
564902b886
@ -36,7 +36,7 @@
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Next char is a-z
|
// Next char is a-z
|
||||||
if (!/[a-z0-9]/i.test(str[i+1])) {
|
if (!/[a-z0-9\$\_]/i.test(str[i+1])) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
start = i+1;
|
start = i+1;
|
||||||
|
@ -161,7 +161,7 @@ function normalisePropertyExpression(str) {
|
|||||||
throw new Error("Invalid property expression: unterminated expression");
|
throw new Error("Invalid property expression: unterminated expression");
|
||||||
}
|
}
|
||||||
// Next char is a-z
|
// Next char is a-z
|
||||||
if (!/[a-z0-9]/i.test(str[i+1])) {
|
if (!/[a-z0-9\$\_]/i.test(str[i+1])) {
|
||||||
throw new Error("Invalid property expression: unexpected "+str[i+1]+" at position "+(i+1));
|
throw new Error("Invalid property expression: unexpected "+str[i+1]+" at position "+(i+1));
|
||||||
}
|
}
|
||||||
start = i+1;
|
start = i+1;
|
||||||
|
@ -333,6 +333,11 @@ describe("red/util", function() {
|
|||||||
it("pass a['a.b[0]'].c",function() { testABC("a['a.b[0]'].c",['a','a.b[0]','c']); })
|
it("pass a['a.b[0]'].c",function() { testABC("a['a.b[0]'].c",['a','a.b[0]','c']); })
|
||||||
it("pass a[0][0][0]",function() { testABC("a[0][0][0]",['a',0,0,0]); })
|
it("pass a[0][0][0]",function() { testABC("a[0][0][0]",['a',0,0,0]); })
|
||||||
|
|
||||||
|
it('pass a.$b.c',function() { testABC('a.$b.c',['a','$b','c']); })
|
||||||
|
it('pass a["$b"].c',function() { testABC('a["$b"].c',['a','$b','c']); })
|
||||||
|
it('pass a._b.c',function() { testABC('a._b.c',['a','_b','c']); })
|
||||||
|
it('pass a["_b"].c',function() { testABC('a["_b"].c',['a','_b','c']); })
|
||||||
|
|
||||||
it("fail a'b'.c",function() { testInvalid("a'b'.c"); })
|
it("fail a'b'.c",function() { testInvalid("a'b'.c"); })
|
||||||
it("fail a['b'.c",function() { testInvalid("a['b'.c"); })
|
it("fail a['b'.c",function() { testInvalid("a['b'.c"); })
|
||||||
it("fail a[]",function() { testInvalid("a[]"); })
|
it("fail a[]",function() { testInvalid("a[]"); })
|
||||||
|
Loading…
Reference in New Issue
Block a user