redhat-developer / vscode-redhat-telemetry

21 stars 25 forks source link

telemetry: simpify SegmentInitializer#hasDebugFlag #3

Closed adietish closed 3 years ago

adietish commented 3 years ago

Current impl looks as follows:

function hasDebugFlag(args: string[]): boolean {
  if (args) {
    // See https://nodejs.org/en/docs/guides/debugging-getting-started/
    return args.some(arg => /^--inspect/.test(arg) || /^--debug/.test(arg));
  }
  return false;
}

This could be simplified to the following (not tested):

function hasDebugFlag(args: string[]): boolean {
  return args && 
    args.some(arg => /^--inspect/.test(arg) || /^--debug/.test(arg));
}