es6-rest-params
v0.3.1
Published
Convert ES6 rest params to ES3:
Downloads
397
Readme
Convert ES6 rest params to ES3:
var join = function(joinStr, ...items) {
return items.join(joinStr);
};
becomes:
var join = function(joinStr) {
var items = [].slice.call(arguments, 1);
return items.join(joinStr);
};
Usage
var compile = require('es6-rest-params').compile;
var output = compile(mySource); // outputs { code: "..." }
// or, for source maps:
var output = compile(mySource, {
sourceFileName: 'foo.js',
sourceMapName: 'foo.js.map'
}); // outputs { code: "...", map: {...} }
Resources
Thanks to Facebook's jstransform for the implementation strategy :)