New:Microsoft Teams Notifications Are Now Available in Socket.Learn more →
Get Started

@dev_x_mohit/opti-kit

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dev_x_mohit/opti-kit

OptiKit is a zero-dependency, ultra-lightweight, and fully tree-shakeable JavaScript/TypeScript utility monorepo library. It ships 25 hand-optimized isomorphic modules — strings, arrays, objects, math, numbers, async, crypto, validation, dates, color conv

Source
npmnpm
Version
1.0.7
Version published
Weekly downloads
25
-37.5%
Maintainers
1
Weekly downloads
 
Created
Source

OptiKit

The Zero-Dependency, Ultra-Lightweight Utility Engine for Modern JavaScript & TypeScript.

NPM Version Socket Security Bundlephobia Size Dependencies License: MIT

OptiKit is a zero-dependency, ultra-lightweight, and fully tree-shakeable JavaScript/TypeScript utility engine designed to replace legacy monolithic packages like Lodash, Moment, and Ramda. Built natively in TypeScript, it ships 25 hand-optimized modules containing 328+ functions in both ES Modules (.mjs) and CommonJS (.js) formats.

Key Highlights

  • ⚡ 14.0 KB Minified + Gzipped (43.6 KB uncompressed total library size)
  • 🛡️ 100/100 Security & Vulnerability Score (Socket Security Verified)
  • 📦 0 External Dependencies — Immune to supply-chain attacks
  • 🌳 100% Tree-Shakeable — Ships with "sideEffects": false
  • 🎯 328+ Isomorphic Utilities across 25 dedicated domain modules
  • 🧪 306 Unit Tests with 100% passing test coverage

Installation

# npm
npm install @dev_x_mohit/opti-kit

# pnpm
pnpm add @dev_x_mohit/opti-kit

# yarn
yarn add @dev_x_mohit/opti-kit

# bun
bun add @dev_x_mohit/opti-kit

25 Modules Overview

ModuleUtilities CountDescription
string45 utilsslugify, truncate, capitalize, escapeHtml, interpolate, titleCase, levenshteinDistance
array40 utilschunk, unique, groupBy, partition, shuffle, intersection, difference, zip
math32 utilsclamp, lerp, mean, median, standardDeviation, factorial, isPrime, gcd, lcm
object31 utilsdeepClone, deepMerge, flattenObject, pick, omit, get, set, compactObject
validate28 utilsisEmail, isUrl, isUuid, isIP, isSemVer, isCreditCard, isJWT, isStrongPassword
date20 utilsrelativeTime, formatDate, isLeapYear, addDays, subMonths, diffInDays, daysInMonth
async19 utilsdebounce, throttle, retry, retryWithBackoff, delay, asyncPool, pMap, timeout
number18 utilsformatCurrency, formatCompact (1K/1M), toOrdinal, formatFileSize, roundToNearest
crypto14 utilsuuid, randomUUID, fnv1a, cyrb53, sha256, sha384, sha512, hmacSha256, base64Encode
color6 utilshexToRgb, rgbToHex, hslToRgb, isHexColor, randomColor
storage1 utilsafeStorage (Isomorphic localStorage/sessionStorage wrapper with JSON & expiry)
events3 utilsEventEmitter (Pub/Sub pattern), delegateEvent, stopEvent
dom12 utilscopyToClipboard, setCookie, getCookie, deleteCookie, createElement, scrollToTop
url8 utilsgetQueryParams, addQueryParam, removeQuery, buildUrl, parseUrl, isAbsoluteUrl
functional10 utilscurry, partial, pipe, compose, once, memoize, memoizeWithTTL, tap, noop
types20 utilsisNil, isObject, isFunction, isDate, isRegExp, isEqual, isEmpty, isBooleanString
units6 utilscelsiusToFahrenheit, fahrenheitToCelsius, milesToKilometers, poundsToKilograms
geometry9 utilsdistance2D, distance3D, midpoint, angleBetween, rotatePoint, circleArea
statistics7 utilsvariance, standardDeviation, zScore, percentile, quartiles, covariance, mode
cache2 utilsLRUCache, memoizeWithTTL
regex2 utilsPre-compiled regex patterns & validation generators
tree2 utilsarrayToTree, treeToArray hierarchical traversals
collection12 utilscountBy, keyBy, sortBy, sample, sampleSize, intersperse
random8 utilsrandomInt, randomFloat, randomBoolean, randomItem
encoding4 utilsutf8Encode, utf8Decode, hexEncode, hexDecode

Code Examples

1. String Casing & Formatting

import { slugify, truncate, escapeHtml } from '@dev_x_mohit/opti-kit';

slugify('OptiKit Zero Dependency!'); // "optikit-zero-dependency"
truncate('Building high performance web apps', 18); // "Building high..."
escapeHtml('<h1>Hello World</h1>'); // "&lt;h1&gt;Hello World&lt;/h1&gt;"

2. Array & Object Operations

import { chunk, unique, groupBy, deepClone, deepMerge } from '@dev_x_mohit/opti-kit';

chunk([1, 2, 3, 4, 5, 6], 2); // [[1, 2], [3, 4], [5, 6]]
unique([1, 1, 2, 3, 3]); // [1, 2, 3]
groupBy([{ r: 'admin' }, { r: 'user' }, { r: 'admin' }], i => i.r); // { admin: [...], user: [...] }

const merged = deepMerge({ a: 1 }, { b: 2 }); // { a: 1, b: 2 }

3. Isomorphic safeStorage Wrapper

import { safeStorage } from '@dev_x_mohit/opti-kit';

// Zero-throw wrapper: works in Next.js/React SSR without window errors!
// Supports native object JSON parsing and custom millisecond expiration times:
safeStorage.setItem('user_session', { id: 'usr_99', role: 'admin' }, 60000); // 1 minute expiration
const session = safeStorage.getItem('user_session'); // { id: 'usr_99', role: 'admin' }

4. Async Retry & Debounce

import { delay, retry, debounce } from '@dev_x_mohit/opti-kit';

await delay(500); // sleep 500ms

// Automatically retry failed API calls 3 times with exponential backoff
const data = await retry(async () => fetchApiData(), 3, 500);

// Debounce expensive handlers
const onSearch = debounce((query) => executeSearch(query), 300);

Version Release History

  • v1.0.6: Verified 100/100 Socket Security & 14.0 KB Gzip Bundlephobia audit. Added cookie helpers (setCookie, getCookie, deleteCookie) and file helpers (getFileExtension, getFileName, formatFileSize).
  • v1.0.5: Added safeStorage isomorphic wrapper and EventEmitter. Fixed DTS ambient Buffer type declaration generator errors.
  • v1.0.4: Added functional programming helpers (curry, partial, noop) and extended string/validation functions.
  • v1.0.3: Added color and crypto modules (uuid, randomUUID, fnv1a, cyrb53, sha256, sha512).
  • v1.0.2: Added statistics and geometry modules.
  • v1.0.1: Added units and cache (LRUCache, memoizeWithTTL) modules.
  • v1.0.0: Initial release of @dev_x_mohit/opti-kit utility monorepo.

Interactive Showcase & Documentation

License

MIT © Mohit Lakhara

Keywords

utilities

FAQs

Package last updated on 21 Jul 2026

Related posts