diff options
author | 2023-02-05 02:26:20 -0800 | |
---|---|---|
committer | 2023-02-05 02:26:20 -0800 | |
commit | f913a468c2d9d57e6e21ed9f5b07d6cce12cc09b (patch) | |
tree | c058ac9f09f58bed54997dad1753d77a18dcde83 /src/string_immutable.zig | |
parent | bd4d8bdb6a7fa3a67a0e7efee3fa375b831317b7 (diff) | |
download | bun-f913a468c2d9d57e6e21ed9f5b07d6cce12cc09b.tar.gz bun-f913a468c2d9d57e6e21ed9f5b07d6cce12cc09b.tar.zst bun-f913a468c2d9d57e6e21ed9f5b07d6cce12cc09b.zip |
WIP
Diffstat (limited to 'src/string_immutable.zig')
-rw-r--r-- | src/string_immutable.zig | 13 |
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); } |