Registry / testing / lodash.rest

lodash.rest

JSON →
library4.0.5jsnpmunverified

This package provides the `_.rest` method from lodash as a standalone, modularized module (v4.0.5). It creates a function that invokes the provided function with arguments from the second argument onward, effectively ignoring the first argument. It is part of the lodash modularized approach, allowing users to cherry-pick individual methods without importing the full lodash library. Useful for functional programming patterns such as transforming callback arguments. Current stable version: 4.0.5. Release cadence is tied to lodash core releases. Key differentiator: zero dependencies, targeting Node.js and bundlers.

npm install lodash.rest
INSTALL
IMPORT
SIG · LODASH.REST
L
lodash.rest
testingjavascriptv4.0.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

rest
✓ var rest = require('lodash.rest');
✗ import rest from 'lodash.rest';
This package uses CommonJS. ESM import may fail in some environments; use require() in Node.js.
rest
✓ import rest from 'lodash.rest';
ESM import works in bundlers and Node.js with 'type': 'module' or .mjs ext.
rest
✓ const rest = require('lodash.rest');
✗ const { rest } = require('lodash.rest');
This package exports a single function, not an object with a 'rest' property. Destructuring will result in undefined.

Demonstrates creating a rest function that ignores the first argument and passes the rest to the original function.

var rest = require('lodash.rest'); var say = function(greeting, name) { return greeting + ' ' + name; }; var sayRest = rest(say); console.log(sayRest('Hello', 'World')); // => 'Hello World' console.log(sayRest('Hello', 'World', '!')); // => 'Hello World' (note: rest ignores first arg, but say only expects two)
Debug
Known issues
gotchaThe package exports a function, not an object with a 'rest' property.
fix
Use require('lodash.rest') directly, not destructuring like { rest }.
affects: >=4.0.0
gotchalodash.rest does not include the full lodash library; ensure you are aware that other lodash methods are not available.
fix
Import each needed method separately (e.g., lodash.map, lodash.filter) or use the full lodash package.
affects: >=4.0.0
deprecatedModularized lodash packages are considered legacy; functionality is available in lodash@4.x under the main package.
fix
Consider using lodash@4 or lodash-es imports: import rest from 'lodash/rest';
affects: >=4.0.0
Errors
Common errors & fixes
Cannot find module 'lodash.rest'
Module is not installed or npm install failed due to missing dependencies or network issues.
fix
Run 'npm install lodash.rest' in your project directory.
TypeError: require(...) is not a function
Importing the package incorrectly (e.g., destructuring).
fix
Change to 'var rest = require('lodash.rest');' and call rest(yourFunction).
Upgrade
Version history
4.0.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
lodash.rest — npm install lodash.rest · libregistry