Skip to content

Commit

Permalink
fix: change the return type
Browse files Browse the repository at this point in the history
  • Loading branch information
Indrani-Gostu committed May 15, 2024
1 parent 61fee84 commit 645e0a3
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions packages/@atjson/offset-annotations/src/utils/social-urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,13 @@ function normalizeInstagramReelURL(url: IUrl) {
// Threads
// - www.threads.net/:handle/post/:id
function isThreadsURL(url: IUrl) {
return (
url.host === "threads.net" &&
!!url.pathname.match(/^\/[^\/]+\/[^\/]+\/[^\/]+/)
);
return url.host === "threads.net";
}

function normalizeThreadsURL(url: IUrl) {
let [username, , id] = without<string>(url.pathname.split("/"), "");
const parts = url.pathname.split("/");
const username = parts[1];
const id = parts[3];
return {
attributes: {
url: `https://threads.net/@${username}/post/${id}`,
Expand Down

0 comments on commit 645e0a3

Please sign in to comment.