diff options
| author | Adam Soltys <[email protected]> | 2024-10-08 20:13:48 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2024-10-10 12:17:05 -0700 |
| commit | 0a2734dfb5ae312f5283f93ab2e3f819ace3f94b (patch) | |
| tree | 9170fc9bb3c7e9bb5b05ccea407321eb6c7302ef /lib/utils.ts | |
| parent | 372c635714f6e7de8a0da135980697b49f207f2c (diff) | |
| download | coinos-server-0a2734dfb5ae312f5283f93ab2e3f819ace3f94b.tar.gz coinos-server-0a2734dfb5ae312f5283f93ab2e3f819ace3f94b.zip | |
nostr revamp wip
Diffstat (limited to 'lib/utils.ts')
| -rw-r--r-- | lib/utils.ts | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/utils.ts b/lib/utils.ts index a805f343..7a663c60 100644 --- a/lib/utils.ts +++ b/lib/utils.ts @@ -168,3 +168,9 @@ export function formatReceipt(items, currency) { } export let t = ({ language = "en" }) => locales[language]; + +export let chunk = (array, chunkSize) => array.reduce((all, one, i) => { + const chunkIndex = Math.floor(i / chunkSize); + (all[chunkIndex] = all[chunkIndex] || []).push(one); + return all; +}, []); |
