mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Revert runtime/util
This commit is contained in:
parent
0be9c88106
commit
e30f8628db
@ -240,7 +240,7 @@ function getMessageProperty(msg,expr) {
|
||||
var msgPropParts = normalisePropertyExpression(expr);
|
||||
var m;
|
||||
msgPropParts.reduce(function(obj, key) {
|
||||
result = ((typeof obj !== "undefined") && (typeof obj[key] !== "undefined") ? obj[key] : undefined);
|
||||
result = (typeof obj[key] !== "undefined" ? obj[key] : undefined);
|
||||
return result;
|
||||
}, msg);
|
||||
return result;
|
||||
|
@ -153,9 +153,11 @@ describe("red/util", function() {
|
||||
var v = util.getMessageProperty({a:"foo"},"msg.b");
|
||||
should.not.exist(v);
|
||||
});
|
||||
it('should return undefined if property parent does not exist', function() {
|
||||
var v = util.getMessageProperty({a:"foo"},"msg.a.b.c");
|
||||
should.not.exist(v);
|
||||
it('should throw error if property parent does not exist', function() {
|
||||
/*jshint immed: false */
|
||||
(function() {
|
||||
util.getMessageProperty({a:"foo"},"msg.a.b.c");
|
||||
}).should.throw();
|
||||
});
|
||||
it('retrieves a property with array syntax', function() {
|
||||
var v = util.getMessageProperty({a:["foo","bar"]},"msg.a[0]");
|
||||
|
Loading…
Reference in New Issue
Block a user