aboutsummaryrefslogtreecommitdiff
path: root/src/string_immutable.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-02-05 02:26:20 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2023-02-05 02:26:20 -0800
commitf913a468c2d9d57e6e21ed9f5b07d6cce12cc09b (patch)
treec058ac9f09f58bed54997dad1753d77a18dcde83 /src/string_immutable.zig
parentbd4d8bdb6a7fa3a67a0e7efee3fa375b831317b7 (diff)
downloadbun-f913a468c2d9d57e6e21ed9f5b07d6cce12cc09b.tar.gz
bun-f913a468c2d9d57e6e21ed9f5b07d6cce12cc09b.tar.zst
bun-f913a468c2d9d57e6e21ed9f5b07d6cce12cc09b.zip
WIP
Diffstat (limited to 'src/string_immutable.zig')
-rw-r--r--src/string_immutable.zig13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/string_immutable.zig b/src/string_immutable.zig
index caf09ae02..d24edb99a 100644
--- a/src/string_immutable.zig
+++ b/src/string_immutable.zig
@@ -3815,6 +3815,19 @@ pub fn sortDesc(in: []string) void {
std.sort.sort([]const u8, in, {}, cmpStringsDesc);
}
+pub const StringArrayByIndexSorter = struct {
+ keys: []const []const u8,
+ pub fn lessThan(sorter: *@This(), a: usize, b: usize) bool {
+ return strings.order(sorter.keys[a], sorter.keys[b]) == .lt;
+ }
+
+ pub fn init(keys: []const []const u8) @This() {
+ return .{
+ .keys = keys,
+ };
+ }
+};
+
pub fn isASCIIHexDigit(c: u8) bool {
return std.ascii.isHex(c);
}