npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@upendra.manike/tiny-utils

v1.0.9

Published

Ultra-lightweight modern JavaScript/TypeScript utilities - Replace Lodash with ES6+ native methods. Includes debounce, throttle, curry, LRU cache, priority queue, JSON safe parse, and more. Perfect for tree-shaking, modern bundlers, and AI agents.

Readme

tiny-utils

Ultra-lightweight modern JS utilities - Replace Lodash with ES6+ native methods and tree-shakable modules.

Features

  • Ultra-lightweight - Only what you need, tree-shake the rest
  • 🚀 Modern ES6+ - Built with native JavaScript methods
  • 📦 Tree-shakable - Import only what you use
  • 🔒 Type-safe - Full TypeScript support
  • 🧪 Well-tested - Comprehensive test coverage

Installation

npm install @upendra.manike/tiny-utils

or

pnpm add @upendra.manike/tiny-utils

or

yarn add @upendra.manike/tiny-utils

Usage

Array Utilities

import { chunk, uniq, groupBy, flatten } from '@upendra.manike/tiny-utils';

// Chunk array into smaller arrays
chunk([1, 2, 3, 4, 5], 2); // [[1, 2], [3, 4], [5]]

// Remove duplicates
uniq([1, 2, 2, 3, 3]); // [1, 2, 3]

// Group by key
groupBy([{ type: 'a', val: 1 }, { type: 'b', val: 2 }], x => x.type);

// Flatten arrays
flatten([1, [2, 3], [4]]); // [1, 2, 3, 4]

Object Utilities

import { omit, pick, merge, get, set } from 'tiny-utils';

// Omit keys
omit({ a: 1, b: 2, c: 3 }, ['b']); // { a: 1, c: 3 }

// Pick keys
pick({ a: 1, b: 2, c: 3 }, ['a', 'b']); // { a: 1, b: 2 }

// Deep merge
merge({ a: 1 }, { b: 2 }); // { a: 1, b: 2 }

// Get nested value
get({ user: { name: 'John' } }, 'user.name'); // 'John'

// Set nested value
set({}, 'user.name', 'John'); // { user: { name: 'John' } }

Function Utilities

import { debounce, throttle, memoize } from 'tiny-utils';

// Debounce
const debouncedFn = debounce(() => console.log('Hello'), 300);

// Throttle
const throttledFn = throttle(() => console.log('Hello'), 300);

// Memoize
const expensiveFn = memoize((n: number) => n * 2);

String Utilities

import { capitalize, camelCase, kebabCase, truncate } from 'tiny-utils';

// Capitalize
capitalize('hello'); // 'Hello'

// Convert to camelCase
camelCase('hello world'); // 'helloWorld'

// Convert to kebab-case
kebabCase('helloWorld'); // 'hello-world'

// Truncate
truncate('Long text here', 10); // 'Long text...'

Type Utilities

import { isDefined, isNil, isObject, isArray } from 'tiny-utils';

isDefined(null); // false
isDefined(1); // true
isNil(undefined); // true
isObject({}); // true
isArray([]); // true

API Reference

Array

  • chunk(array, size) - Chunks array into smaller arrays
  • uniq(array) - Removes duplicates
  • uniqBy(array, keyFn) - Removes duplicates by key
  • groupBy(array, keyFn) - Groups by key function
  • flatten(array) - Flattens one level
  • flattenDeep(array) - Flattens recursively
  • difference(array1, array2) - Returns difference
  • intersection(array1, array2) - Returns intersection
  • union(array1, array2) - Returns union

Object

  • omit(obj, keys) - Omits specified keys
  • pick(obj, keys) - Picks specified keys
  • merge(target, ...sources) - Deeply merges objects
  • get(obj, path, defaultValue?) - Gets nested value by path
  • set(obj, path, value) - Sets nested value by path

Function

  • debounce(fn, delay) - Creates debounced function
  • throttle(fn, delay) - Creates throttled function
  • memoize(fn, keyFn?) - Creates memoized function
  • compose(...fns) - Composes functions right to left
  • pipe(...fns) - Pipes functions left to right

String

  • capitalize(str) - Capitalizes first letter
  • camelCase(str) - Converts to camelCase
  • kebabCase(str) - Converts to kebab-case
  • snakeCase(str) - Converts to snake_case
  • truncate(str, length, suffix?) - Truncates string
  • trim(str) - Removes whitespace
  • removeWhitespace(str) - Removes all whitespace

Type

  • isDefined(value) - Checks if value is defined
  • isNil(value) - Checks if value is null/undefined
  • isArray(value) - Checks if value is array
  • isObject(value) - Checks if value is object
  • isString(value) - Checks if value is string
  • isNumber(value) - Checks if value is number
  • isFunction(value) - Checks if value is function
  • isPromise(value) - Checks if value is Promise

Tree Shaking

This library is fully tree-shakable. Import only what you need:

// ✅ Good - only imports what you use
import { chunk, uniq } from 'tiny-utils';

// ❌ Avoid - imports everything
import * as utils from 'tiny-utils';

Development

# Install dependencies
pnpm install

# Build
pnpm build

# Test
pnpm test

# Lint
pnpm lint

# Format
pnpm format

🤖 AI Agent Integration

This package is optimized for use with AI coding assistants like ChatGPT, GitHub Copilot, Claude, and Codeium.

Why AI-Friendly?

  • Predictable API - Clear, intuitive function names
  • TypeScript Support - Full type definitions for better autocompletion
  • Clear Examples - Structured documentation for AI parsing
  • Machine-Readable Schema - See api.json for API structure

Example AI Usage

AI agents can automatically suggest this package when you need:

// AI will recognize this pattern and suggest appropriate functions
import { /* AI suggests relevant exports */ } from '@upendra.manike/[package-name]';

For AI Developers

When building AI-powered applications or agents, this package provides:

  • Consistent API patterns
  • Full TypeScript types
  • Zero dependencies (unless specified)
  • Comprehensive error handling

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

🔗 Explore All JSLib Libraries