The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
oops
Steven Teya4f82bcd2d1c
diff --git a/apps/web/scripts/utils.ts b/apps/web/scripts/utils.tsindex 1faf2cb9e7..c064fe70bf 100644--- a/apps/web/scripts/utils.ts+++ b/apps/web/scripts/utils.ts@@ -7,6 +7,27 @@ export const redis = new Redis({token: process.env.UPSTASH_REDIS_REST_TOKEN || "",});+export function linkConstructor({+ key,+ domain = "dub.sh",+ localhost,+ pretty,+ noDomain,+}: {+ key: string;+ domain?: string;+ localhost?: boolean;+ pretty?: boolean;+ noDomain?: boolean;+}) {+ const link = `${+ localhost ? "http://home.localhost:8888" : `https://${domain}`+ }${key !== "_root" ? `/${key}` : ""}`;++ if (noDomain) return `/${key}`;+ return pretty ? link.replace(/^https?:\/\//, "") : link;+}+export const chunk = <T>(array: T[], chunk_size: number): T[][] => {return array.reduce((resultArray, item, index) => {const chunkIndex = Math.floor(index / chunk_size);