export default function compare<T>(a0: T, b0: T): number { | |
if (a0 === b0) return 0; | |
if (a0 > b0) return 1; | |
return -1; | |
} |
<code>gist:darylwright/75332f27a6e9bff70bc0406114570829</code>
`gist:darylwright/75332f27a6e9bff70bc0406114570829`
export default function compare<T>(a0: T, b0: T): number { | |
} |
<code>gist:darylwright/75332f27a6e9bff70bc0406114570829?file=gist-test.ts&lines=2-4</code>
`gist:darylwright/75332f27a6e9bff70bc0406114570829?file=gist-test.ts&lines=2-4`
export default function compare<T>(a0: T, b0: T): number { | |
if (a0 === b0) return 0; | |
if (a0 > b0) return 1; | |
return -1; | |
} |
<code>gist:darylwright/75332f27a6e9bff70bc0406114570829?file=gist-test.ts&highlights=1,3-5</code>
`gist:darylwright/75332f27a6e9bff70bc0406114570829?file=gist-test.ts&highlights=1,3-5`
export default function compare<T>(a0: T, b0: T): number { | |
} |
<code>gist:darylwright/75332f27a6e9bff70bc0406114570829?file=gist-test.ts&highlights=1&lines=2-4</code>
`gist:darylwright/75332f27a6e9bff70bc0406114570829?file=gist-test.ts&highlights=1&lines=2-4`
const twitterUrlRegex = /(https?:\/\/)(www.)?twitter.com\//g; | |
export function getTwitterHandleFromUrl(profileUrl: string): string { | |
const twitterUserName = profileUrl.replaceAll(twitterUrlRegex, ``); | |
if (twitterUserName) { | |
return `@${twitterUserName}`; | |
} | |
return ``; | |
} |
export default function getReadingTimeText(duration: number): string { | |
const roundedDuration = Math.ceil(duration); | |
if (roundedDuration === 1) { | |
return `${roundedDuration} min`; | |
} | |
return `${roundedDuration} mins`; | |
} |
<code>gist:darylwright/f0bf18c86c236c2daf7fcaf28ec759be</code>
`gist:darylwright/75332f27a6e9bff70bc0406114570829?file=gist-test.ts&highlights=1&lines=2-4`