mirror of
https://github.com/oven-sh/bun
synced 2026-02-10 10:58:56 +00:00
fix semver edge cases and buffer used for prerelease comparisons (#6981)
* use different buf for group and manifest versions * tests * tests for installs that should fail * allow `<=<prerelease-version` * `Bun.semver.satisfies` * one * stringify * symbol tests * deinit * arena * more tests * fix test * version always on the left * `Bun.semver.order` * handle more edge cases, more tests * whitespace * more
This commit is contained in:
@@ -4367,6 +4367,19 @@ pub fn trim(slice: anytype, comptime values_to_strip: []const u8) @TypeOf(slice)
|
||||
return slice[begin..end];
|
||||
}
|
||||
|
||||
pub fn lengthOfLeadingWhitespaceASCII(slice: string) usize {
|
||||
for (slice) |*c| {
|
||||
switch (c.*) {
|
||||
' ', '\t', '\n', '\r', std.ascii.control_code.vt, std.ascii.control_code.ff => {},
|
||||
else => {
|
||||
return @intFromPtr(c) - @intFromPtr(slice.ptr);
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
return slice.len;
|
||||
}
|
||||
|
||||
pub fn containsNonBmpCodePointUTF16(_text: []const u16) bool {
|
||||
const n = _text.len;
|
||||
if (n > 0) {
|
||||
|
||||
Reference in New Issue
Block a user