Skip to content

BaryoDev Libraries

Zero-dependency, ultra-lightweight JavaScript utility libraries

CILicense: MIT

A collection of tiny, focused utility packages with zero runtime dependencies. Each package is designed to do one thing well.

📦 Packages

PackageDescriptionSize
nano-clsxConditional className builder<300b
nano-slugURL-safe slug generator<400b
nano-safe-storageFault-tolerant localStorage wrapper<600b
nano-human-bytesHuman-readable byte formatting<500b
tiny-debounce-throttleDebounce/throttle with cancel/flush<600b
tiny-time-agoRelative time formatting<500b
click-outside-liteClick outside detection<400b
deep-merge-liteDeep merge with array strategies<700b
deep-clean-objRemove null/undefined from objects<500b
resilient-fetcherFetch with retry/timeout<800b

Installation

Install any package individually:

npm install nano-clsx nano-slug nano-safe-storage
# or
pnpm add deep-merge-lite resilient-fetcher

nano-clsx

Conditional className builder (alternative to clsx/classnames).

import{clsx}from'nano-clsx';clsx('foo','bar');// 'foo bar'clsx({active: true,hidden: false});// 'active'clsx(['a',{b: true}]);// 'a b'

nano-slug

URL-safe slug generator with custom replacements.

import{slugify}from'nano-slug';slugify('Hello World');// 'hello-world'slugify('Café Résumé');// 'cafe-resume'slugify('Rock & Roll');// 'rock-and-roll'slugify('Long Title',{maxLength: 10});// 'long-title'

nano-safe-storage

Fault-tolerant localStorage with TTL and namespacing.

import{createStorage}from'nano-safe-storage';conststorage=createStorage({prefix: 'app_',ttl: 3600});storage.set('user',{name: 'John'});storage.get('user');// { name: 'John' }storage.set('token','abc',{ttl: 900});// 15 min TTL

nano-human-bytes

Human-readable byte formatting.

import{formatBytes,parseBytes}from'nano-human-bytes';formatBytes(1536);// '1.5 KB'formatBytes(1536,{bits: true});// '12.29 Kb'parseBytes('1.5 KB');// 1536

tiny-debounce-throttle

Debounce/throttle with cancel, flush, and RAF support.

import{debounce,throttle}from'tiny-debounce-throttle';constsearch=debounce(fetchResults,300,{maxWait: 1000});search('query');search.cancel();search.flush();constanimate=throttle.raf(updatePosition);

tiny-time-ago

Relative time formatting with locale support.

import{timeAgo,createTimeAgo}from'tiny-time-ago';timeAgo(Date.now()-60000);// '1 minute ago'timeAgo(newDate('2024-12-23'));// '1 day ago'constago=createTimeAgo('es');ago(newDate('2024-12-23'));// 'hace 1 día'

click-outside-lite

Detect clicks outside elements (modals, dropdowns).

import{onClickOutside}from'click-outside-lite';constcleanup=onClickOutside(modalRef,handleClose,{once: true,ignore: ['.tooltip']});

deep-merge-lite

Deep merge with array strategies and cloneDeep.

import{merge,cloneDeep}from'deep-merge-lite';merge({},objA,objB);merge({},objA,objB,{arrayMerge: 'concat'});constcopy=cloneDeep(original);

deep-clean-obj

Remove null, undefined, and empty values from objects.

import{clean}from'deep-clean-obj';clean({a: 1,b: null,c: ''});// { a: 1 }clean(obj,{preserveEmptyArrays: true});clean(obj,{exclude: ['meta.*']});

resilient-fetcher

Fetch wrapper with retry, timeout, and backoff.

import{resilientFetch}from'resilient-fetcher';constresponse=awaitresilientFetch('https://api.example.com',{retries: 3,timeout: 5000,backoff: 'exponential'});

Development

# Install dependencies
pnpm install
# Run tests
pnpm test# Build all packages
pnpm build
# Run benchmarks
pnpm bench

License

MIT © BaryoDev

About

Zero-dependency TypeScript utility packages, published to npm with Changesets and GitHub Actions CI.

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages