Refactor to use ai/rsc (#253)
This commit is contained in:
parent
69ca8fcc22
commit
e85ba803dd
66 changed files with 2799 additions and 740 deletions
20
lib/utils.ts
20
lib/utils.ts
|
|
@ -41,3 +41,23 @@ export function formatDate(input: string | number | Date): string {
|
|||
year: 'numeric'
|
||||
})
|
||||
}
|
||||
|
||||
export const formatNumber = (value: number) =>
|
||||
new Intl.NumberFormat('en-US', {
|
||||
style: 'currency',
|
||||
currency: 'USD'
|
||||
}).format(value)
|
||||
|
||||
export const runAsyncFnWithoutBlocking = (
|
||||
fn: (...args: any) => Promise<any>
|
||||
) => {
|
||||
fn()
|
||||
}
|
||||
|
||||
export const sleep = (ms: number) =>
|
||||
new Promise(resolve => setTimeout(resolve, ms))
|
||||
|
||||
export const getStringFromBuffer = (buffer: ArrayBuffer) =>
|
||||
Array.from(new Uint8Array(buffer))
|
||||
.map(b => b.toString(16).padStart(2, '0'))
|
||||
.join('')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue