{"id":11349,"library":"moderndash","title":"ModernDash","description":"ModernDash is a TypeScript-first utility library designed as a performant and lightweight alternative to Lodash, optimized for modern browsers and enhanced developer experience. Currently stable at version 4.0.2, it follows a release cadence driven by feature additions, bug fixes, and security patches, with major versions tied to breaking changes like Node.js version bumps. Key differentiators include its strict TypeScript adherence (no `any` types), ESM-only distribution, tree-shakable design, and a strong focus on outperforming Lodash in most benchmarks while maintaining zero runtime dependencies. It selectively implements only essential utility functions, encouraging the use of native JavaScript alternatives where available, contrasting with Lodash's more comprehensive API surface.","status":"active","version":"4.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/maxdewald/moderndash","tags":["javascript","lodash","utility","helper","underscore","esm","typescript"],"install":[{"cmd":"npm install moderndash","lang":"bash","label":"npm"},{"cmd":"yarn add moderndash","lang":"bash","label":"yarn"},{"cmd":"pnpm add moderndash","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ModernDash is ESM-only since v3; CommonJS require statements will fail.","wrong":"const chunk = require('moderndash').chunk","symbol":"chunk","correct":"import { chunk } from 'moderndash'"},{"note":"Ensure your project is configured for ESM. For TypeScript, set `\"module\": \"esnext\"` or similar in `tsconfig.json`.","wrong":"const camelCase = require('moderndash').camelCase","symbol":"camelCase","correct":"import { camelCase } from 'moderndash'"},{"note":"Named imports are the standard pattern. There is no default export.","wrong":"const merge = require('moderndash').merge","symbol":"merge","correct":"import { merge } from 'moderndash'"}],"quickstart":{"code":"import { chunk, camelCase, merge } from 'moderndash';\n\nconsole.log('--- moderndash Quickstart ---');\n\n// Example 1: Chunk an array into smaller arrays\nconst myArray = [1, 2, 3, 4, 5, 6, 7];\nconst chunkedArray = chunk(myArray, 3);\nconsole.log('Chunked array:', chunkedArray);\n// Expected: [[1, 2, 3], [4, 5, 6], [7]]\n\n// Example 2: Convert a string to camel case\nconst myString = 'hello world moderndash example';\nconst camelCasedString = camelCase(myString);\nconsole.log('Camel cased string:', camelCasedString);\n// Expected: \"helloWorldModerndashExample\"\n\n// Example 3: Deep merge objects\nconst object1 = { 'a': [{ 'b': 2 }, { 'd': 4 }] };\nconst object2 = { 'a': [{ 'c': 3 }, { 'e': 5 }] };\nconst mergedObject = merge(object1, object2);\nconsole.log('Merged object:', JSON.stringify(mergedObject, null, 2));\n/* Expected (keys merged by index in arrays):\n{\n  \"a\": [\n    { \"b\": 2, \"c\": 3 },\n    { \"d\": 4, \"e\": 5 }\n  ]\n}*/","lang":"typescript","description":"This quickstart demonstrates how to install ModernDash and use fundamental utility functions like `chunk`, `camelCase`, and `merge` in a TypeScript environment."},"warnings":[{"fix":"Upgrade your Node.js environment to version 20.x or newer. Alternatively, pin your `moderndash` dependency to `<4.0.0`.","message":"ModernDash v4.0.0 and later require Node.js version 20.x or higher. Projects running on older Node.js versions will encounter errors.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Upgrade to `moderndash@4.0.1` or newer immediately to mitigate prototype pollution vulnerabilities. Review your application for any sensitive operations involving `merge` or `set`.","message":"Functions `merge` and `set` in versions prior to v4.0.1 were vulnerable to prototype pollution. This could allow attackers to inject arbitrary properties into `Object.prototype`, potentially leading to denial-of-service or remote code execution.","severity":"breaking","affected_versions":"<4.0.1"},{"fix":"Migrate deprecated function calls to their native JavaScript equivalents. The library prioritizes minimal API surface and encourages native solutions where available.","message":"Several utility functions including `difference`, `intersection`, `isUrl`, and `groupBy` have been deprecated in favor of native JavaScript APIs (e.g., `Set.prototype.intersection()`, `URL.canParse`, `Object.groupBy`).","severity":"deprecated","affected_versions":">=3.11.0"},{"fix":"Upgrade to `moderndash@4.0.2` or newer to ensure correct and comprehensive deburring of a wider range of special characters.","message":"The `deburr` function prior to v4.0.2 incorrectly handled certain ligatures and special Latin characters (e.g., æ, œ, ß, ø), passing them through unchanged instead of decomposing them. This could result in unexpected string normalization behavior.","severity":"gotcha","affected_versions":"<4.0.2"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Refactor your import statements to use ES Module syntax: `import { chunk } from 'moderndash';` and ensure your project is configured for ESM.","cause":"Attempting to import ModernDash functions using CommonJS `require()` syntax in an ESM-only environment.","error":"SyntaxError: Named export 'chunk' not found. The requested module 'moderndash' does not provide an export named 'chunk'"},{"fix":"Update your Node.js environment to version 20 or higher. You can use a tool like `nvm` to manage Node.js versions.","cause":"Using ModernDash v4.x or later with an unsupported Node.js version.","error":"Error: The 'moderndash' package requires Node.js version >=20.x. You are running Node.js version X."},{"fix":"Ensure your build setup (e.g., Babel, Webpack, Vite) is correctly configured for ES Modules, allowing `import` statements to resolve `moderndash` properly. Verify `\"type\": \"module\"` in your `package.json` if running in Node.js, or adjust bundler configurations.","cause":"A bundler or transpiler might be incorrectly transforming ESM imports to CommonJS, or a CommonJS context is trying to use an ESM-only library.","error":"TypeError: (0 , _moderndash.merge) is not a function"}],"ecosystem":"npm"}