Registry / serialization / lodash.restparam

lodash.restparam

JSON →
library3.6.1jsnpmunverified

This package provides a modular build of Lodash's `_.restParam` function, designed to create a new function that collects arguments from a specified position into an array. While `lodash.restparam` is at version 3.6.1, the broader Lodash ecosystem has progressed to version 4.x. In Lodash v4.0.0, the `_.restParam` function was renamed to `_.rest`. Furthermore, all individual, per-method `lodash.*` packages, including `lodash.restparam`, are officially discouraged by the Lodash team and are slated for removal in Lodash v5. Modern JavaScript (ES6+) introduced native rest parameters (`...args`), which largely supersede the functionality provided by `_.restParam`. The package is unmaintained and should generally be avoided in favor of native features or direct imports from the main `lodash` package.

npm install lodash.restparam
INSTALL
IMPORT
SIG · LODASH.RESTPARAM
L
lodash.restparam
serializationjavascriptv3.6.1
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
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
musl
node 18226 runs
build_error
glibc
node 18226 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+.
fix
Use `_.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.
fix
Migrate 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.
fix
Favor 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.
fix
Discontinue 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`.
fix
Update 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.
fix
Replace `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`.
Upgrade
Version history
3.6.1latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources