Skip to content

Commit

Permalink
simplify logic
Browse files Browse the repository at this point in the history
  • Loading branch information
RiskyMH committed Jan 10, 2025
1 parent 335faa8 commit c32b8d6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/fs.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1713,6 +1713,7 @@ pub const Path = struct {

pub fn isJSONCFile(this: *const Path) bool {
const str = this.name.filename;

if (strings.eqlComptime(str, "package.json") or strings.eqlComptime(str, "bun.lock")) {
return true;
}
Expand All @@ -1721,11 +1722,11 @@ pub const Path = struct {
return true;
}

if (!(strings.hasPrefixComptime(str, "tsconfig.") or strings.hasPrefixComptime(str, "jsconfig."))) {
return false;
if (strings.hasPrefixComptime(str, "tsconfig.") or strings.hasPrefixComptime(str, "jsconfig.")) {
return strings.hasSuffixComptime(str, ".json");
}

return strings.hasSuffixComptime(str, ".json");
return false;
}

pub const PackageRelative = struct {
Expand Down

0 comments on commit c32b8d6

Please sign in to comment.