aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-09-02 19:26:07 -0700
committerGravatar Jarred Sumner <jarred@jarredsumner.com> 2021-09-02 19:26:07 -0700
commit3fc0c899c97977cc7843bf809c36dcdafb369144 (patch)
tree63826bbbfec39a693fa93a64d21f362d86c2debc
parent2e58176ac741c18111234bdf49216daecba78bd6 (diff)
downloadbun-3fc0c899c97977cc7843bf809c36dcdafb369144.tar.gz
bun-3fc0c899c97977cc7843bf809c36dcdafb369144.tar.zst
bun-3fc0c899c97977cc7843bf809c36dcdafb369144.zip
endsWith("") should return true
Former-commit-id: fdbb66abc4e539ef960a72588495cd9964eff68b
-rw-r--r--src/string_immutable.zig2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/string_immutable.zig b/src/string_immutable.zig
index 8706f4053..f48850908 100644
--- a/src/string_immutable.zig
+++ b/src/string_immutable.zig
@@ -203,7 +203,7 @@ pub fn startsWith(self: string, str: string) bool {
}
pub inline fn endsWith(self: string, str: string) bool {
- return @call(.{ .modifier = .always_inline }, std.mem.endsWith, .{ u8, self, str });
+ return str.len == 0 or @call(.{ .modifier = .always_inline }, std.mem.endsWith, .{ u8, self, str });
}
pub fn endsWithAny(self: string, str: string) bool {