aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-08-05 21:49:27 -0700
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-08-05 21:49:27 -0700
commitc74df4c880cf5acbe667414b338dfb15ba027def (patch)
treea3fcde682b6f2ec9b13331b3a4f99292eca4cbcf /src
parente34190fe66f820d0b191ccd16c03c6306a057073 (diff)
downloadbun-c74df4c880cf5acbe667414b338dfb15ba027def.tar.gz
bun-c74df4c880cf5acbe667414b338dfb15ba027def.tar.zst
bun-c74df4c880cf5acbe667414b338dfb15ba027def.zip
Fix https://github.com/oven-sh/bun/issues/996
Diffstat (limited to 'src')
-rw-r--r--src/cli/init_command.zig10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/cli/init_command.zig b/src/cli/init_command.zig
index fe5164110..13d15ce15 100644
--- a/src/cli/init_command.zig
+++ b/src/cli/init_command.zig
@@ -68,7 +68,7 @@ pub const InitCommand = struct {
// toLowerCase
const needs_normalize = brk: {
for (input) |c| {
- if ((c >= 'A' and c <= 'Z') or c == ' ' or c == '"' or c == '\'') {
+ if ((std.ascii.isUpper(c)) or c == ' ' or c == '"' or c == '\'') {
break :brk true;
}
}
@@ -80,13 +80,11 @@ pub const InitCommand = struct {
}
var new = try allocator.alloc(u8, input.len);
- for (new) |c, i| {
- if (c >= 'A' and c <= 'Z') {
- new[i] = c + ('a' - 'A');
- } else if (c == ' ' or c == '"' or c == '\'') {
+ for (input) |c, i| {
+ if (c == ' ' or c == '"' or c == '\'') {
new[i] = '-';
} else {
- new[i] = c;
+ new[i] = std.ascii.toLower(c);
}
}