function checkFlags(flags) {
  const seen = new Set();

  for (const flag of flags) {
    if (seen.has(flag) || !validFlags.includes(flag)) {
      throw new SyntaxError(`Invalid flags: ${flags}`);
    }
    seen.add(flag);
  }

  return flags.split('').sort().join('');
}
function checkFlags(flags) {
  const seen = new Set();

  for (const flag of flags) {
    if (seen.has(flag) || !validFlags.includes(flag)) {
      throw new SyntaxError(`Invalid flags: ${flags}`);
    }
    seen.add(flag);
  }

  return flags.split('').sort().join('');
}
function checkFlags ( flags ) { const seen = new Set ( ) ; for ( const flag of flags ) { if ( seen . has ( flag ) || ! validFlags . includes ( flag ) ) { throw new SyntaxError ( ` ${ flags } ` ) ; } seen . add ( flag ) ; } return flags . split ( '' ) . sort ( ) . join ( '' ) ; }
Checks the flags are valid, and that
we don't duplicate flags.
Checks the flags are valid and that we don t duplicate flags .