Skip to content

Commit 48842e9

Browse files
refactor: use URL.canParse to check if string is URL
1 parent e8d5eff commit 48842e9

File tree

3 files changed

+1
-43
lines changed

3 files changed

+1
-43
lines changed

lib/fetch-references.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { mf2tojf2 } from "../index.js";
22
import { fetchMf2 } from "./fetch-mf2.js";
3-
import { isUrl } from "./is-url.js";
43

54
/**
65
* Get a list of URLs that can be referenced
@@ -15,7 +14,7 @@ const referenceableUrls = (jf2) => {
1514
if (Object.prototype.hasOwnProperty.call(jf2, key)) {
1615
const value = jf2[key];
1716

18-
if (typeof value === "string" && isUrl(value) && key !== "url") {
17+
if (typeof value === "string" && URL.canParse(value) && key !== "url") {
1918
urls.push(value);
2019
}
2120
}

lib/is-url.js

-19
This file was deleted.

test/is-url.js

-22
This file was deleted.

0 commit comments

Comments
 (0)