Skip to content

(bad patch) .. } else if (typeof fc === 'string'){ #51

@Red-Owl

Description

@Red-Owl

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;
  }
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions