From 0a2734dfb5ae312f5283f93ab2e3f819ace3f94b Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 8 Oct 2024 20:13:48 -0700 Subject: nostr revamp wip --- lib/utils.ts | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'lib/utils.ts') 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; +}, []); -- cgit v1.2.3