Skip to content

Commit

Permalink
Fix #236 : Handle null value & uppercase value in house, room & devic…
Browse files Browse the repository at this point in the history
…eType name in parser
  • Loading branch information
Pierre-Gilles committed Nov 14, 2017
1 parent 007de53 commit ecbb3c0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion api/core/brain/parser/parser.devicetype.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ module.exports = function(originalText){
* Return true if the deviceName is present in the sentence
*/
function present(text, type){
return (text.toLowerCase().indexOf(type) > -1);
return (text.toLowerCase().indexOf(type ? type.toLowerCase() : type) > -1);
}
2 changes: 1 addition & 1 deletion api/core/brain/parser/parser.house.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ module.exports = function(originalText){
* Return true if the houseName is present in the sentence
*/
function present(text, type){
return (text.toLowerCase().indexOf(type.toLowerCase()) > -1);
return (text.toLowerCase().indexOf(type ? type.toLowerCase() : type) > -1);
}
2 changes: 1 addition & 1 deletion api/core/brain/parser/parser.room.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ module.exports = function(originalText){
* Return true if the roomName is present in the sentence
*/
function present(text, type){
return (text.toLowerCase().indexOf(type.toLowerCase()) > -1);
return (text.toLowerCase().indexOf(type ? type.toLowerCase() : type) > -1);
}

0 comments on commit ecbb3c0

Please sign in to comment.