Registry / devops / es6-rest-params

es6-rest-params

JSON →
library0.3.1jsnpmunverified

A small utility to compile ES6 rest parameters (function(...args)) down to ES3-compatible code using `[].slice.call(arguments, 1)`. Version 0.3.1 is the latest release; the package has been in maintenance mode since 2016 and is not actively developed. It uses Facebook's jstransform internally and supports source maps via options. For modern projects, Babel or TypeScript are preferred, but this package remains useful for legacy setups or learning.

npm install es6-rest-params
INSTALL
IMPORT
SIG · ES6-REST-PARAMS
E
es6-rest-params
devopsjavascriptv0.3.1
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.

compile
import { compile } from 'es6-rest-params'
const compile = require('es6-rest-params').compile
Package uses CommonJS, but TypeScript or bundlers prefer named import. Default import is not available.
default
import es6RestParams from 'es6-rest-params'
No default export; only named export 'compile' is available.
compile
const { compile } = require('es6-rest-params')
const compile = require('es6-rest-params')
Direct require returns an object with compile property, not the function itself.

Demonstrates how to import and use compile to transform ES6 rest params to ES3 with source map support.

import { compile } from 'es6-rest-params'; const input = `function join(sep, ...items) { return items.join(sep); }`; const result = compile(input, { sourceFileName: 'input.js', sourceMapName: 'input.js.map' }); console.log(result.code); // Output: function join(sep) { var items = [].slice.call(arguments, 1); return items.join(sep); }
Debug
Known issues
breakingPackage does not support ES6 arrow functions or default parameters; only rest parameters are transpiled.
fix
Use a full transpiler like Babel for ES6+ features.
affects: *
deprecatedPackage is no longer maintained; jstransform is outdated.
fix
Migrate to Babel or TypeScript.
affects: >=0.1
gotchaThe compile function expects string input; passing non-string may cause silent errors.
fix
Ensure input is a JavaScript source string.
affects: *
Errors
Common errors & fixes
TypeError: compile is not a function
Incorrect import: using default import instead of named import.
fix
Use `import { compile } from 'es6-rest-params'` or `const { compile } = require('es6-rest-params')`.
Cannot read property 'code' of undefined
compile() returns undefined if input is empty or invalid.
fix
Verify input string is non-empty and contains valid JavaScript.
Upgrade
Version history
0.3.1latest on npm
Audit
Dependencies
jstransformoptionalCore dependency for transforming ES6 rest params to ES3
Agent activity
2 hits · last 30 days
node
2
Resources
es6-rest-params — npm install es6-rest-params · libregistry