Skip to content

Commit

Permalink
Fixed handling of empty output values
Browse files Browse the repository at this point in the history
  • Loading branch information
rsenden committed Jun 6, 2019
1 parent 210d26c commit 4617d96
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ device id to be controlled.

## Version history

* _1.0.3_: Fixed handling of empty output values
* _1.0.2_: Fixed handling of input values that are null or not a string
* _1.0.1_: Some documentation updates & fixes
* _1.0.0_: Initial version
Expand Down
8 changes: 3 additions & 5 deletions map.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ module.exports = function(RED) {
if ( !outValue && node.forwardIfNoMatch ) {
outValue = mustache.render(node.defaultIfNoMatch, msg);
}
if ( outValue ) {
if ( outValue || node.forwardIfNoMatch ) {
RED.util.setMessageProperty(msg, node.out, outValue);
node.send(msg);
}
Expand All @@ -141,10 +141,8 @@ module.exports = function(RED) {

try {
var outValue = node.config.getMappingValue('both', node.from, node.outLhsOrRhs, false);
if (outValue) {
RED.util.setMessageProperty(msg, node.out, outValue);
node.send(msg);
}
RED.util.setMessageProperty(msg, node.out, outValue);
node.send(msg);
}
catch(err) {
node.error(err.message, msg);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-contrib-map",
"version": "1.0.2",
"version": "1.0.3",
"description": "Map property values based on configurable mapping",
"repository": {
"type": "git",
Expand Down

0 comments on commit 4617d96

Please sign in to comment.