awesome-tiny-js
🤏 A collection of tiny JS libraries (under 2 kB) to put your bundle on a diet
https://github.com/thoughtspile/awesome-tiny-js
Last synced: 17 days ago
JSON representation
API Layer
Reactive Programming
Colors
Reactive Programming
- freaky math.
- colord - Manipulate colors and convert between spaces, . Extra features come as plugins, 150b to 1.5 kB each.
- colr - More of the same,
- polychrome - More of the same,
- randomcolor - Attractive random colors with configuration.
Dates and Time
Reactive Programming
- `Intl.DateTimeFormat`
- dayjs - Almost moment.js-compatible API, covers most use cases,
-
tinytime
- Simple date / time formatter:
{h}:{mm} -> 9:33, -
tinydate
- Date / time formatter, only supports padded numeric output (
September -> 09), - time-stamp - More of the same,
-
ms
- Parse & format ms durations, e.g.
"1m" <-> 60000, - timeago.js - Format dates into stuff like X minutes ago or in X hours,
- fromnow - More of the same,
- date-fns - Not tiny as a whole, but most functions are under 1 kB each (format and parse are quite heavy).
Event Emitters
- mitt - Plain event emitter that I use on most projects,
-
nanoevents
- Nicer unsubscribe API, but no
*event, -
onfire.js
- Also has
.oncemethod,
Footnotes
Fuzzy search
Generic Utilities
Reactive Programming
- remeda - 90 tree-shakable helpers (list).
- rambda - 187 tree-shakable helpers (list).
- just - 82 helpers in separate packages (list).
- @fxts/core - 96 tree-shakable helpers. Lazy evaluation support.
- underscore, - 1 kB helpers. It does not tree-shake as well as the libraries above due to codebase structure.
I18N
Reactive Programming
- @nanostores/i18n - Detect locale, load dictionaries, format dates / numbers, including nanostores.
- eo-locale - Interpolation and dates / numbers, , or with react bindings.
-
rosetta
- Bare-bones template strings (
{{hello}}, {{username}}) and custom functions for everyting else, - lingui - Small core with template strings,
Routers and URL Utils
Reactive Programming
- wouter - Declarative router for React / preact, , also available as a standalone hook:
- @nanostores/router - Routes as a nanostores store (framework-agnostic),
- navaid - History-based observable router,
- matchit - Route parser and matcher in
- regexparam - Convert path to regexp in
- qss - Parse querystrings in . Not sure you need it, URL API support is good.
State Managers
Reactive Programming
- flyd - Rx-styled event streams,
- callbag-basics - Rx-style event streams,
Signals
- hyperactiv - 4 functions to make objects observable and listen to changes,
- flimsy - Signals from Solid (it almost fit into UI frameworks category itself). Author warning: it's probably buggy.
- oby - shaking, but otherwise is around 7 kB.
- @preact/signals - The OG signals from preact core, with react integration.
- usignal - A smaller signal implementation,
- zustand - Simple stores with pleasant actions and selectors. Vanilla , React
- nanostores - Modular store with good tree-shaking support, vanilla, + React extra. Supports all the top frameworks.
- exome - Atomic stores with lots of framework connectors, + React extra. Supports all the top frameworks.
- storeon - Minimal redux-styled store with lots of framework connectors, . React extra + Vue, Svelte, Angular.
- unistore - Centralized store with actions, + React
- teaful - Store with useState-like API, , including React / preact connector.
Text Search
Fuzzy search
- fuzzy - Index-free, can highlight matches.
- fuzzy-search - With stateful index.
-
fzy.js
- Matches one string at a time, tree-shakeable scores and match highlighting. total, or ~150 bytes for
hasMatchonly. - fuzzysearch - One string at a time, does not compute score / rank.
-
liquidmetal
- Quicksilver algorithm, prioritizes matches at start of word for command abbreviations (e.g.
gp->git push). One string at a time. - quick-score - Another quicksilver-based lib, tweaked for long strings. Built-in list filtering and sorting, or 1.2 kB for single-string scoring.
- fuzzyset - Find misspellings, e.g. missipissi -> Missisipi, Commercial usage costs $42.
Reactive Programming
- Porter stemmers
- js-search - Feature-rich and customizable: multi-field indices, stop words, custom stemmers and tokenizers.
- ndx - Similar to js-search, differs in ranking and is less strict for multi-word queries (compare). Supports field weights.
- wade - Also similar, (compare)
- libsearch - Index-free search (slower, but easier to use) with sane ordering
- stemmer -
- porter-stemmer -
- snowball-js - languages](https://github.com/MihaiValentin/lunr-languages) supports 30 languages but only works with lunr, the most promising one is natural but it depends on Node.js.
Touch Gestures
Reactive Programming
- alloyfinger - Pan, swipe, tap, doubletap, longpress, and pinch / rotate. My personal favorite. .
- tinygesture - Configurable pan, swipe, tap, doubletap, longpress. .
- pointer-tracker - Unified interface for mouse, touch and pointer events,
- detect-it - Detect present and primary input method (touch / mouse) and supported events,
- any-touch - gesture,](https://github.com/react-component/gesture) used in ant design system, could be the only react component on the list, but babel-runtime / corejs polyfills hard-wired into the build push the ~2.5 kB size to over 10 kB.
UI Frameworks
- openly experimental
- preact - React-like API (pre-hooks). Cool ecosystem of similarly tiny tools and components. Highly recommended.
- hyperapp - vDOM framework with pure JS syntax and immutable state,
- redom - Hyperapp-style templates with imperative event listeners and updates,
- fre - React-like library with hooks and concurrency,
- van - vDOM-based framework optimized for no-build setups,
- superfine - Hyperapp with state & effect hooks removed,
- arrowjs - Tagged templates + reactive data,
- umbrella - jQuery-style DOM manipulation library,
- 500x less popular than preact.
Unique ID Generation
Reactive Programming
- native `crypto.randomUUID` - api_crypto_randomuuid)
- @lukeed/uuid - Real UUIDs,
- nanoid - Random IDs with larger alphabet,
- uid - More of the same,
- hexoid - Hexadecimal IDs,
Validation
Reactive Programming
-
v8n
- zod-style API with fine-grained checks:
v8n().string().minLength(5).first("H").last("o"). No tree shaking, - banditypes - The smallest validation library:
- superstruct - The most popular modular validation library with good tree-shaking,
- deep-waters - Composable functional validators, .
- valibot - Another modular validation library,