Skip to content

Commit

Permalink
refactor: use URL.canParse to check if string is URL
Browse files Browse the repository at this point in the history
  • Loading branch information
paulrobertlloyd committed Jan 16, 2024
1 parent e8d5eff commit 48842e9
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 43 deletions.
3 changes: 1 addition & 2 deletions lib/fetch-references.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { mf2tojf2 } from "../index.js";
import { fetchMf2 } from "./fetch-mf2.js";
import { isUrl } from "./is-url.js";

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

if (typeof value === "string" && isUrl(value) && key !== "url") {
if (typeof value === "string" && URL.canParse(value) && key !== "url") {
urls.push(value);
}
}
Expand Down
19 changes: 0 additions & 19 deletions lib/is-url.js

This file was deleted.

22 changes: 0 additions & 22 deletions test/is-url.js

This file was deleted.

0 comments on commit 48842e9

Please sign in to comment.