mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-26 02:47:17 +00:00
cant return from the function from inside forEach apparently
This commit is contained in:
parent
4493647b08
commit
2739e14892
1 changed files with 6 additions and 2 deletions
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue