cant return from the function from inside forEach apparently

This commit is contained in:
Jacob Rosenthal 2015-01-21 00:10:38 -07:00
parent 4493647b08
commit 2739e14892

View file

@ -139,13 +139,13 @@ function SerialPortFactory() {
if (typeof fc === 'boolean') {
options.rtscts = true;
} else {
fc.forEach(function (flowControl) {
var clean = fc.every(function (flowControl) {
var fcup = flowControl.toUpperCase();
var idx = FLOWCONTROLS.indexOf(fcup);
if (idx < 0) {
var err = new Error('Invalid "flowControl": ' + fcup + ". Valid options: " + FLOWCONTROLS.join(", "));
callback(err);
return;
return false;
} else {
// "XON", "XOFF", "XANY", "DTRDTS", "RTSCTS"
@ -155,8 +155,12 @@ function SerialPortFactory() {
case 2: options.xany = true; break;
case 3: options.rtscts = true; break;
}
return true;
}
});
if(!clean){
return;
}
}
}