There was an error while loading. Please reload this page.
1 parent 8ab9364 commit 70a009aCopy full SHA for 70a009a
src/url.zig
@@ -217,6 +217,18 @@ pub const URL = struct {
217
buf.appendSliceAssumeCapacity(query_string);
218
return buf.items;
219
}
220
+
221
+ // Compares two URLs, returning true if it is the same document.
222
+ pub fn eqlDocument(self: *const URL, other: *const URL, arena: Allocator) !bool {
223
+ if (!std.mem.eql(u8, self.scheme(), other.scheme())) return false;
224
+ if (!std.mem.eql(u8, self.host(), other.host())) return false;
225
+ if (self.port() != other.port()) return false;
226
227
+ const path1 = try self.uri.path.toRawMaybeAlloc(arena);
228
+ const path2 = try other.uri.path.toRawMaybeAlloc(arena);
229
230
+ return std.mem.eql(u8, path1, path2);
231
+ }
232
};
233
234
const StitchOpts = struct {
0 commit comments