From c7bcd3f438df3d5033445fa07d73d39c66b8138d Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 4 Feb 2016 21:43:18 +0000 Subject: [PATCH] Don't default inject payload to blank string --- nodes/core/core/20-inject.js | 4 ++-- red/runtime/util.js | 8 +++----- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/nodes/core/core/20-inject.js b/nodes/core/core/20-inject.js index fe2998501..05c863cd6 100644 --- a/nodes/core/core/20-inject.js +++ b/nodes/core/core/20-inject.js @@ -1,5 +1,5 @@ /** - * Copyright 2013, 2015 IBM Corp. + * Copyright 2013, 2016 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -58,7 +58,7 @@ module.exports = function(RED) { } else if (this.payloadType == 'none') { msg.payload = ""; } else { - msg.payload = RED.util.evaluateNodeProperty(this.payload,this.payloadType,this,msg)||""; + msg.payload = RED.util.evaluateNodeProperty(this.payload,this.payloadType,this,msg); } this.send(msg); msg = null; diff --git a/red/runtime/util.js b/red/runtime/util.js index b2ac2dc50..9e96bc4b6 100644 --- a/red/runtime/util.js +++ b/red/runtime/util.js @@ -1,5 +1,5 @@ /** - * Copyright 2014, 2015 IBM Corp. + * Copyright 2014, 2016 IBM Corp. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -153,8 +153,7 @@ function evaluateNodeProperty(value, type, node, msg) { if (type === 'str') { return ""+value; } else if (type === 'num') { - /*jshint -W053 */ - return new Number(value); + return Number(value); } else if (type === 'json') { return JSON.parse(value); } else if (type === 're') { @@ -166,8 +165,7 @@ function evaluateNodeProperty(value, type, node, msg) { } else if (type === 'global' && node) { return node.context().global.get(value); } else if (type === 'bool') { - /*jshint -W053 */ - return new Boolean(/^true$/i.test(value)); + return /^true$/i.test(value); } return value; }