{"library":"lodash.restparam","title":"lodash.restparam","description":"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.","language":"javascript","status":"deprecated","last_verified":"Tue Apr 21","install":{"commands":["npm install lodash.restparam"],"cli":null},"imports":["import restParam from 'lodash.restparam';","const restParam = require('lodash.restparam');","import { rest } from 'lodash';"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import restParam from 'lodash.restparam';\n\nconst greetWithManyNames = restParam(function(greeting, ...names) {\n  return `${greeting} ${names.join(', ')}!`;\n}, 1); // Collect all arguments from index 1 (the second argument) onwards\n\nconsole.log(greetWithManyNames('Hello', 'Alice', 'Bob', 'Charlie'));\n// Expected output: \"Hello Alice, Bob, Charlie!\"\n\n// Demonstrating the equivalent with native rest parameters, preferred in modern JS:\nfunction modernGreet(greeting, ...names) {\n  return `${greeting} ${names.join(', ')}!`;\n}\nconsole.log(modernGreet('Hi', 'David', 'Eve'));\n// Expected output: \"Hi David, Eve!\"","lang":"javascript","description":"Demonstrates the usage of `lodash.restparam` to create a function that handles a variable number of arguments, alongside its modern native JavaScript equivalent.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}