Skip to content

Commit

Permalink
refactor: rm usage of Intl
Browse files Browse the repository at this point in the history
  • Loading branch information
exuanbo committed Oct 17, 2024
1 parent 6b6d375 commit 9112f48
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
3 changes: 1 addition & 2 deletions src/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ export class Container {

private throwUnresolvableError(tokens: Token[]): never {
const tokenNames = tokens.map((token) => token.name);
const formatter = new Intl.ListFormat("en", {style: "narrow"});
assert(false, ErrorMessage.UnresolvableToken, formatter.format(tokenNames));
assert(false, ErrorMessage.UnresolvableToken, tokenNames.join(", "));
}
}
3 changes: 1 addition & 2 deletions src/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ export const ErrorMessage = {
// @internal
export function assert(condition: unknown, ...args: any[]): asserts condition {
if (!condition) {
const formatter = new Intl.ListFormat("en", {style: "narrow", type: "unit"});
throw new Error(formatter.format(args));
throw new Error(args.join(" "));
}
}

Expand Down

0 comments on commit 9112f48

Please sign in to comment.