@har-analyzer/components 0.0.5 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,43 @@
1
+ import { g as i } from "./content-type.js";
2
+ function p(e) {
3
+ if (typeof e != "string")
4
+ throw new TypeError("File contents are invalid. Expected contents to be a stringified JSON.");
5
+ try {
6
+ return JSON.parse(e);
7
+ } catch (r) {
8
+ const t = "Failed to JSON parse file content";
9
+ throw console.error(t, r), new Error(t);
10
+ }
11
+ }
12
+ function u(e) {
13
+ return e?.log.entries ?? [];
14
+ }
15
+ function d(e, r) {
16
+ return r.length ? e.filter((n) => {
17
+ const s = n.response.content.mimeType, o = i(s);
18
+ return r.includes(o);
19
+ }) : e;
20
+ }
21
+ function a(e) {
22
+ const r = e.response.status;
23
+ return r < 200 || r >= 400;
24
+ }
25
+ function f(e) {
26
+ return e.filter((r) => a(r));
27
+ }
28
+ function g(e, r) {
29
+ const t = /* @__PURE__ */ new Set();
30
+ return e.forEach((n) => {
31
+ n[r].headers.forEach((o) => {
32
+ t.add(o.name);
33
+ });
34
+ }), Array.from(t);
35
+ }
36
+ export {
37
+ u as a,
38
+ d as b,
39
+ f as c,
40
+ g as d,
41
+ p as g,
42
+ a as i
43
+ };