Zero runtime dependencies
Nothing but the platform. No Lodash, no qs, no deepmerge — enforced by a CI check on every build.
145 modular, immutable, tree-shakeable utilities for JavaScript and TypeScript. Zero runtime dependencies. A lightweight alternative to Lodash.
npm install modern-fnsimport { groupBy, set, diff, slugify, currency } from 'modern-fns';
groupBy(orders, 'status'); // { paid: [...], pending: [...] }
set(state, 'user.address.city', 'Kochi'); // immutable — `state` untouched
diff(pristine, form); // [{ path: 'name', type: 'changed', ... }]
slugify('Hello Vue World!'); // 'hello-vue-world'
currency(1299.5, 'INR', 'en-IN'); // '₹1,299.50'| Module | What it covers |
|---|---|
| array | chunk, unique, groupBy, indexBy, partition, sortBy, orderBy, zip, range, diffArray |
| object | get, set, has, unset, pick, omit, deepClone, deepMerge, isEqual, flattenObject |
| diff | structural diffs for dirty checking, audit logs, PATCH bodies and undo/redo |
| string | slugify, camelCase, kebabCase, truncate, initials, mask, stripHtml, isEmail |
| number | clamp, decimal-safe round, percentage, formatNumber, abbreviate, currency, tax |
| url | parseUrl, buildUrl, setQuery, mergeQuery, removeHash, joinUrl, isSameUrl |
| query | parse, stringify, get, set, toggle, parseArray — a dependency-free qs alternative |
| value | toNumber, toBoolean, toDate, toArray plus typed guards for untrusted input |
| functional | pipe, compose, debounce, throttle, memoize, once, tryCatch, tap |
| collection | one iteration API across arrays, objects, Map, Set and iterables |
Lodash predates ES modules, TypeScript-by-default and bundle-size budgets. modern-fns is built for those constraints: native ESM with an exports map, types generated from the source rather than a separate @types package, and immutability as a rule rather than a per-function detail.
The full comparison is honest about where Lodash is still the better choice.