Sign Up for Free

RunKit +

Try any Node.js package right in your browser

This is a playground to test code. It runs a full Node.js environment and already has all of npm’s 1,000,000+ packages pre-installed, including reduce-args with all npm packages installed. Try it out:

var reduceArgs = require("reduce-args")

This service is provided by RunKit and is not affiliated with npm, Inc or the package authors.

reduce-args v0.0.1

Remove or strip arguments from function calls in and with JavaScript


Remove function calls or strip arguments in javascript code. Useful for removing debug messages in a production build. The next step after using this small tool, would be to compress the code with something like UglifyJS.

Uses Recast for parsing the code.


invariant(isArray(obj), "obj should be an array!");




var reduceArgs = require('reduce-args');

var min = reduceArgs(testCode, [
    // removes all console.*() calls
    { test: /^console./, removeCall: true },
    // keeps only the argument at index 0 at calls to invariant()
    { test: /^invariant$/, keepArgs: [0] },
    // drops all arguments to invariant()
    { test: /^invariant$/, keepArgs: [] },
    // drops the argument at index 1, and keeps the rest
    { test: /^invariant$/, stripArgs: [1] }


See the tests for more details.


npm install reduce-args

RunKit is a free, in-browser JavaScript dev environment for prototyping Node.js code, with every npm package installed. Sign up to share your code.
Sign Up for Free