News for hackers. Stuff that matters.
Re:Claude Code's source code has been leaked via a map file ... by worksonmine on Tuesday March 31, 2026 @07:12AM (#47585641)
> Why even use else if with return...

What is the problem with that? How would you write that snippet? It is common in the new functional js landscape, even if it is pass-by-ref.

Re:Claude Code's source code has been leaked via a map file ... by Overpower0416 on Tuesday March 31, 2026 @07:31AM (#47585811)
Using guard clauses. Way more readable and easy to work with.

  export function extractSearchToken(completionToken: {
    token: string;
    isQuoted?: boolean;
  }): string {
    if (completionToken.isQuoted) {
      return completionToken.token.slice(2).replace(/"$/, '');
    }
    if (completionToken.token.startsWith('@')) {
      return completionToken.token.substring(1);
    }
    return completionToken.token;
  }