browser-serialport
browser-serialport copied to clipboard
(bad patch) .. } else if (typeof fc === 'string'){
options.rtscts = _options.rtscts;
if (options.flowControl || options.flowcontrol) { var fc = options.flowControl || options.flowcontrol;
if (typeof fc === 'boolean') {
options.rtscts = true;
} else if (typeof fc === 'string'){
var fcup = fc.toUpperCase();
var idx = FLOWCONTROLS.indexOf(fcup);
if (idx < 0) {
var err = new Error('Invalid "flowControl": ' + fcup + '. Valid options: ' + FLOWCONTROLS.join(', '));
callback(err);
return false;
} else {
// "XON", "XOFF", "XANY", "DTRDTS", "RTSCTS"
switch (idx) {
case 0:
options.rtscts = true;
break;
}
return true;
}
}else{
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 false;
} else {
// "XON", "XOFF", "XANY", "DTRDTS", "RTSCTS"
switch (idx) {
case 0:
options.rtscts = true;
break;
}
return true;
}
});
if(!clean){
return;
}
}
}