Skip to content

Commit cb89860

Browse files
committed
refactor(if_match): use external module
1 parent fcf81aa commit cb89860

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

_tools/meta.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,15 +95,15 @@ export const makeOptions = (version: string): BuildOptions => ({
9595
name: "@httpland/accept-ranges-parser",
9696
version: "1.0.0",
9797
},
98-
"https://deno.land/x/[email protected]/trim.ts": {
99-
name: "@miyauci/prelude",
100-
version: "1.0.0",
101-
subPath: "trim",
102-
},
10398
"https://deno.land/x/[email protected]/to_lower_case.ts": {
10499
name: "@miyauci/prelude",
105100
version: "1.0.0",
106101
subPath: "to_lower_case",
107102
},
103+
"https://deno.land/x/[email protected]/list.ts": {
104+
name: "@httpland/http-utils",
105+
version: "1.2.0",
106+
subPath: "list.js",
107+
},
108108
},
109109
});

deps.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export { isNull } from "https://deno.land/x/[email protected]/is_null.ts";
1212
export { isString } from "https://deno.land/x/[email protected]/is_string.ts";
1313
export { isNumber } from "https://deno.land/x/[email protected]/is_number.ts";
1414
export { isNegativeNumber } from "https://deno.land/x/[email protected]/number/is_negative_number.ts";
15-
export { trim } from "https://deno.land/x/[email protected]/trim.ts";
1615
export { toLowerCase } from "https://deno.land/x/[email protected]/to_lower_case.ts";
1716
export {
1817
type Handler,
@@ -57,6 +56,7 @@ export {
5756
parseAcceptRanges,
5857
type Token,
5958
} from "https://deno.land/x/[email protected]/mod.ts";
59+
export { parseListFields } from "https://deno.land/x/[email protected]/list.ts";
6060

6161
export function not<T extends readonly unknown[]>(
6262
fn: (...args: T) => boolean,

if_match.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// TODO(miyauci): External Packaging
55

6-
import { type ETag, parseETag, trim } from "./deps.ts";
6+
import { type ETag, parseETag, parseListFields } from "./deps.ts";
77

88
export type IfMatch = Star | ETag[];
99
export type IfNoneMatch = IfMatch;
@@ -15,9 +15,5 @@ export type Star = "*";
1515
export function parse(input: string): IfMatch | IfNoneMatch {
1616
if (input === "*") return input;
1717

18-
return input
19-
.split(",")
20-
.map(trim)
21-
.filter(Boolean)
22-
.map(parseETag);
18+
return parseListFields(input).map(parseETag);
2319
}

0 commit comments

Comments
 (0)