diff options
author | 2023-09-10 22:15:35 -0800 | |
---|---|---|
committer | 2023-09-10 23:15:35 -0700 | |
commit | 51d3d4382281f789f8175079ed426a63529eb3e7 (patch) | |
tree | 14f6fe77a1e3b300488e9343d8e9d54f64bde376 /src/string_immutable.zig | |
parent | edea4f095a3bebf54f986c0fa038482316f4cde8 (diff) | |
download | bun-51d3d4382281f789f8175079ed426a63529eb3e7.tar.gz bun-51d3d4382281f789f8175079ed426a63529eb3e7.tar.zst bun-51d3d4382281f789f8175079ed426a63529eb3e7.zip |
Support named imports for json & toml files at runtime (#4783)
* Support named exports in json imports
* Support named imports for `*.json` files
* Remove stale comments
* Don't export arrays as non-default
* Add test for default exports
* Don't break webpack
---------
Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
Diffstat (limited to 'src/string_immutable.zig')
-rw-r--r-- | src/string_immutable.zig | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/string_immutable.zig b/src/string_immutable.zig index d2d71621f..03ba35e66 100644 --- a/src/string_immutable.zig +++ b/src/string_immutable.zig @@ -925,6 +925,10 @@ pub fn hasPrefixComptime(self: string, comptime alt: anytype) bool { return self.len >= alt.len and eqlComptimeCheckLenWithType(u8, self[0..alt.len], alt, false); } +pub fn hasSuffixComptime(self: string, comptime alt: anytype) bool { + return self.len >= alt.len and eqlComptimeCheckLenWithType(u8, self[self.len - alt.len ..], alt, false); +} + inline fn eqlComptimeCheckLenWithKnownType(comptime Type: type, a: []const Type, comptime b: []const Type, comptime check_len: bool) bool { @setEvalBranchQuota(9999); if (comptime check_len) { |