Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
restParam
✓ import restParam from 'lodash.restparam';
✗ import { restParam } from 'lodash.restparam';
This package is an old, unmaintained CommonJS module, but bundlers often provide ESM interoperability. Named imports are incorrect for this module's export style.
restParam (CommonJS)
✓ const restParam = require('lodash.restparam');
This is the documented and intended way to import this module.
Rest parameter (modern Lodash)
✓ import { rest } from 'lodash';
✗ import { restParam } from 'lodash';
In modern Lodash (v4+), the function is named `rest`, not `restParam`. The dedicated `lodash.restparam` package is deprecated; prefer importing `rest` from the main `lodash` package or using native rest parameters.
Demonstrates the usage of `lodash.restparam` to create a function that handles a variable number of arguments, alongside its modern native JavaScript equivalent.
import restParam from 'lodash.restparam';
const greetWithManyNames = restParam(function(greeting, ...names) {
return `${greeting} ${names.join(', ')}!`;
}, 1); // Collect all arguments from index 1 (the second argument) onwards
console.log(greetWithManyNames('Hello', 'Alice', 'Bob', 'Charlie'));
// Expected output: "Hello Alice, Bob, Charlie!"
// Demonstrating the equivalent with native rest parameters, preferred in modern JS:
function modernGreet(greeting, ...names) {
return `${greeting} ${names.join(', ')}!`;
}
console.log(modernGreet('Hi', 'David', 'Eve'));
// Expected output: "Hi David, Eve!"
Debug
Known issues
breakingThe `_.restParam` function was renamed to `_.rest` in Lodash v4.0.0. This `lodash.restparam` package is locked at version 3.x, meaning it will not provide the updated function name or any features from Lodash v4+.fixUse `_.rest` from the main `lodash` package or, preferably, native JavaScript rest parameters (`...args`). If you must use `_.restParam`, stick to Lodash v3.x or this specific modular package.
affects: >=4.0.0 (for main lodash, this package is unaffected as it's v3.x)
deprecatedAll individual, per-method `lodash.*` packages (like `lodash.restparam`) are officially discouraged by the Lodash team and are scheduled for removal in Lodash v5. They often lead to larger bundle sizes compared to importing specific functions from the main `lodash` package.fixMigrate to using native JavaScript rest parameters (`...args`) or import `_.rest` directly from the main `lodash` package (e.g., `import { rest } from 'lodash';`). Lodash provides a `jscodeshift` transform to assist with this migration. affects: All versions of `lodash.restparam`
gotchaNative JavaScript introduced rest parameters (`...args`) in ES6 (ES2015), providing equivalent functionality to `_.restParam` and `_.rest`. Using this `lodash.restparam` package often introduces unnecessary dependency and bundle size.fixFavor native JavaScript rest parameters (`function foo(arg1, ...restArgs)`) over `lodash.restparam`. This reduces bundle size and avoids external dependencies for a standard language feature.
affects: <6.0.0 (for Node.js), prior to ES2015 for browsers
gotchaAs an unmaintained, older modular package, `lodash.restparam` will not receive security updates. The main `lodash` package has had security advisories (e.g., prototype pollution fixes in v4.18.0) which would not be patched in this specific module.fixDiscontinue use of this package and migrate to native JavaScript rest parameters or the `_.rest` function from the actively maintained `lodash` main package.
affects: All versions of `lodash.restparam`
Errors
Common errors & fixes
TypeError: _.restParam is not a function
You are likely trying to use `_.restParam` with a version of Lodash v4.0.0 or higher where the function was renamed to `_.rest`.
fixUpdate your code to use `_.rest` instead of `_.restParam`, or use native JavaScript rest parameters (`...args`). If you are directly importing `lodash.restparam`, ensure your project does not implicitly rely on a newer version of Lodash.
Bundle size unexpectedly large despite only using a few Lodash functions.
Modular `lodash.*` packages like `lodash.restparam` bundle their internal dependencies. If multiple such packages are used, or if the main `lodash` package is also present, it can lead to duplicated code in your final bundle, circumventing potential tree-shaking benefits.
fixReplace `lodash.restparam` with native JavaScript rest parameters (`...args`). For other Lodash functions, prefer importing specific methods directly from the main `lodash` package (e.g., `import { someMethod } from 'lodash';`) and leverage modern bundlers for tree-shaking, or use `babel-plugin-lodash`. Audit
Dependencies
No dependency data recorded yet.