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 38 hand-optimized isomorphic modules. Every function is side-effect free, individually importable, and ships with full TypeS

Source
npmnpm
Version
1.0.8
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 38 hand-optimized modules containing 434+ functions in both ES Modules (.mjs) and CommonJS (.js) formats.

Key Highlights

  • ⚡ 16.0 KB Minified + Gzipped
  • 🛡️ 100/100 Security & Vulnerability Score (Socket Security Verified)
  • 📦 0 External Dependencies — Immune to supply-chain attacks
  • 🌳 100% Tree-Shakeable — Ships with "sideEffects": false
  • 🎯 434+ Isomorphic Utilities across 38 dedicated domain modules
  • 🧪 426 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

38 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
crypto10 utilsuuid, fnv1a, cyrb53, sha256, sha384, sha512, hmacSha256, generateToken
color10 utilshexToRgb, rgbToHex, hslToRgb, rgbToHsl, hexToHsl, lighten, darken, getContrastRatio
storage1 objsafeStorage (Isomorphic localStorage/sessionStorage wrapper with JSON & expiry)
events7 utilsEventEmitter (Pub/Sub pattern), listen, listenOnce, delegateEvent, waitForEvent
dom14 utilscopyToClipboard, setCookie, getCookie, deleteCookie, createElement, scrollToTop
url8 utilsjoinPaths, parseUrl, stringifyQuery, buildUrl, isAbsoluteUrl
functional14 utilscurry, partial, pipe, compose, onceFn, memoize, constant, not, trampoline
types14 utilsisNil, isObject, isFunction, isDate, isRegExp, isString, isNumber, isPromise
units8 utilscelsiusToFahrenheit, fahrenheitToCelsius, milesToKilometers, poundsToKilograms
geometry9 utilsdistance2D, distance3D, midpoint, angleBetween, rotatePoint, circleArea
statistics12 utilsvariance, standardDeviation, zScore, percentile, covariance, correlation, skewness
cache2 utilsLRUCache, memoizeWithTTL
regex1 objPre-compiled regex patterns & validation generators
tree2 utilsarrayToTree, treeToArray hierarchical traversals
collection12 utilscountBy, keyBy, sortBy, symmetricDifference, mergeMaps, frequencies, filterMap
random9 utilsrandomUUID, randomColor, randomBoolean, randomFloat, randomItem, randomIntFast
encoding8 utilsutf8Encode, utf8Decode, hexEncode, hexDecode, base64Encode, base64Decode
guard12 utilssafeJsonParse, safeJsonStringify, safeParseInt, attempt, invariant, assertDefined
format9 utilsformatDuration, formatPhoneNumber, formatCreditCardNumber, formatPercentage, pluralize
schema12 utilsLightweight rule validation runner (validateObject, required, minLength, minValue)
browser16 utilsSSR-safe browser feature and environment checks (isBrowser, isChrome, isMobile)
json6 utilsDeep JSON utilities (jsonClone, jsonFlatten, jsonUnflatten, jsonPath, jsonMerge, jsonDiff)
store4 utilsUltra-lightweight reactive primitives (signal, computed, effect, createStore)
http5 utilsIsomorphic network fetch wrappers (fetchJson, fetchWithTimeout, fetchWithRetry)
csv2 utilsTable processing utilities (csvParse, csvStringify)
log2 utilsCustom level-based ANSI loggers (createLogger, ansi)
ds4 classesAdvanced standard data structures (Stack, Queue, PriorityQueue, BiMap)
template2 utilsIsomorphic logic-less micro template engine (render, compile)
keyboard2 utilsIsomorphic hotkeys listener and key press state checking (registerShortcut, isKeyPressed)
semver5 utilsSemVer 2.0 parser, validator, comparator, and range checker (semverCompare, semverSatisfies)

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