aboutsummaryrefslogtreecommitdiff
path: root/src/comptime_string_map.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-30 05:49:01 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-11-30 05:49:01 -0800
commit6213a91f058cc461fb916d479f03f602c552c377 (patch)
tree5442b8e30a1eebfda378586913dd56a27bd3ba88 /src/comptime_string_map.zig
parentf999bdca26256b7ad42d93268c34362b251330c2 (diff)
downloadbun-jarred/make-strings-better.tar.gz
bun-jarred/make-strings-better.tar.zst
bun-jarred/make-strings-better.zip
[wip internal] Introduce `bun.String` which wraps `WTF::String` and allows us to reuse themjarred/make-strings-better
Diffstat (limited to '')
-rw-r--r--src/comptime_string_map.zig5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/comptime_string_map.zig b/src/comptime_string_map.zig
index 18b06d9de..5f3779c9b 100644
--- a/src/comptime_string_map.zig
+++ b/src/comptime_string_map.zig
@@ -134,12 +134,13 @@ pub fn ComptimeStringMapWithKeyType(comptime KeyType: type, comptime V: type, co
}
pub fn getWithEql(input: anytype, comptime eql: anytype) ?V {
- if (input.len < precomputed.min_len or input.len > precomputed.max_len)
+ const length = input.length();
+ if (length < precomputed.min_len or length > precomputed.max_len)
return null;
comptime var i: usize = precomputed.min_len;
inline while (i <= precomputed.max_len) : (i += 1) {
- if (input.len == i) {
+ if (length == i) {
return getWithLengthAndEql(input, i, eql);
}
}