Show HN: Ultra-lightweight chunker library with emoji support
Published on: 2025-06-13 01:50:29
Ultra-lightweight chunker for everything โ arrays, strings, sets, maps, async iterables and more.
๐ฆ Installation
npm install chonkify
โจ Features
Works with everything: Array, String, Buffer, Set, Map, Array-like, TypedArray
Array, String, Buffer, Set, Map, Array-like, TypedArray Supports AsyncIterable ( for await )
( ) Correctly handles Unicode emoji and complex symbols ๐จโ๐ฉโ๐งโ๐ฆ ๐ณ๏ธโ๐ ๐
and complex symbols ๐จโ๐ฉโ๐งโ๐ฆ ๐ณ๏ธโ๐ ๐ Minimal size: core just 870 bytes, entire package ~5.5 kB
core just 870 bytes, entire package ~5.5 kB Zero dependencies
ESM-first, TypeScript-ready
๐งช Usage
import { chonk , chonkAsync } from 'chonkify' ; // Basic examples chonk ( [ 1 , 2 , 3 , 4 ] , 2 ) ; // [[1, 2], [3, 4]] chonk ( 'abcdef' , 2 ) ; // ['ab', 'cd', 'ef'] // Unicode emoji support chonk ( '๐๐โ๏ธ๐' , 2 ) ; // ['๐๐', 'โ๏ธ๐'] chonk ( '๐จโ๐ฉโ๐งโ๐ฆ๐ณ๏ธโ๐' , 1 ) ; // ['๐จโ๐ฉโ๐งโ๐ฆ', '๐ณ๏ธโ๐'] // Async usage: for await ( const group of chonkAsync ( fetchLines ( ) , 100 ) ) { console . log ( group ) ; }
๐ AP
... Read full article.