Skip to content

Commit 96a51e1

Browse files
committed
refactor: use external and remove unused
1 parent d32fe1b commit 96a51e1

File tree

4 files changed

+23
-36
lines changed

4 files changed

+23
-36
lines changed

deno.lock

Lines changed: 8 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

deps.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,12 @@ export {
3030
Method,
3131
} from "https://deno.land/x/[email protected]/method.ts";
3232
export {
33+
compareStrong,
34+
compareWeak,
3335
type ETag,
3436
type ETagFormat,
35-
parse as parseETag,
36-
} from "https://deno.land/x/etag_parser@1.0.0/mod.ts";
37+
parseETag,
38+
} from "https://deno.land/x/etag_parser@1.1.0/mod.ts";
3739
export { isErr, unsafe } from "https://deno.land/x/[email protected]/mod.ts";
3840
export { ascend } from "https://deno.land/[email protected]/collections/_comparators.ts";
3941
export { withContentRange } from "https://deno.land/x/[email protected]/transform.ts";

etag.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

preconditions/utils.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
// Copyright 2023-latest the httpland authors. All rights reserved. MIT license.
22
// This module is browser compatible.
33

4-
import { isString, isValidDate, parseETag, parseHttpDate } from "../deps.ts";
4+
import {
5+
compareStrong,
6+
compareWeak,
7+
isString,
8+
isValidDate,
9+
parseETag,
10+
parseHttpDate,
11+
} from "../deps.ts";
512
import { parse } from "../if_match.ts";
6-
import { matchStrong, matchWeak } from "../etag.ts";
713

814
const enum Msg {
915
InvalidField = "field value is invalid <HTTP-date> format.",
@@ -22,7 +28,7 @@ export function ifMatch(
2228

2329
if (isStar(ifMatch)) return true;
2430

25-
return ifMatch.some((etag) => matchStrong(etag, etagObj));
31+
return ifMatch.some((etag) => compareStrong(etag, etagObj));
2632
}
2733

2834
/** Match `If-None-Match` field and `ETag` field.
@@ -34,7 +40,7 @@ export function ifNoneMatch(fieldValue: string, etag: string): boolean {
3440

3541
if (isStar(ifNoneMatch)) return false;
3642

37-
return ifNoneMatch.every((tag) => !matchWeak(tag, etagObj));
43+
return ifNoneMatch.every((tag) => !compareWeak(tag, etagObj));
3844
}
3945

4046
/**
@@ -103,7 +109,7 @@ export function ifRange(fieldValue: string, headers: IfRangeHeaders): boolean {
103109
const left = parseETag(fieldValue);
104110
const right = parseETag(etag);
105111

106-
return matchStrong(left, right);
112+
return compareStrong(left, right);
107113
}
108114

109115
if (!isString(lastModified)) throw Error();

0 commit comments

Comments
 (0)