fix: crash in bun init by renaming string function to be more consistant (#7746)

This commit is contained in:
dave caruso
2023-12-20 13:44:53 -08:00
committed by GitHub
parent 00e745ec2c
commit 00955c712e
4 changed files with 48 additions and 5 deletions

View File

@@ -713,6 +713,10 @@ pub inline fn startsWithChar(self: string, char: u8) bool {
}
pub inline fn endsWithChar(self: string, char: u8) bool {
return self.len > 0 and self[self.len - 1] == char;
}
pub inline fn endsWithCharOrIsZeroLength(self: string, char: u8) bool {
return self.len == 0 or self[self.len - 1] == char;
}