npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

pargras

v1.1.1

Published

Pargras is a minimalistic helper around function arguments for Node.js and the browser. Pargras has a fluent interface and supports adding, removing and altering arguments before applying them to a function.

Readme

Pargras

Pargras is a minimalistic helper around function arguments for Node.js and the Browser. Pargras has a fluent interface and supports adding, removing and altering arguments before applying them to a function.

Getting started

Node.js

Install pargras using npm.

npm install pargras --save

Then require it into any module.

const Pargras = require('pargras');

Browser

You can download the latest release from the repository

Use a script tag to directly add Pargras to the global scope.

<script src="pargras.min.js"></script>

Usage

function specialMin()
{
    // Instantiate the arguments helper.
    const args = new Pargras(arguments);

    // Remove first and last parameter, then call Math.min() with the resulting arguments.
    var min = args.shift().pop().applyTo(Math.min);
}

specialMin(0, 2, 3, 4, 1);
// -> 2

Examples

Return the function arguments as an array.

function afunc()
{
    // Instantiate the arguments helper.
    const args = new Pargras(arguments);

    // Return the function arguments as an array.
    return args.array();
}

afunc(0, 1, "two", true);
// -> [ 0, 1, "two", true ]

Return the number of arguments passed to a function.

function afunc()
{
    // Instantiate the arguments helper.
    const args = new Pargras(arguments);

    // Return the number of arguments passed to function.
    return args.length();
}

afunc(0, 1, "two", true);
// -> 4

Alter an argument value.

function afunc()
{
    // Instantiate the arguments helper.
    const args = new Pargras(arguments);

    // Check value.
    args.get(1);
    // -> "banana"

    // Alter second argument value.
    args.set(1, 'altered');

    // Check value again.
    args.get(1);
    // -> "altered"

    // Return sorted arguments.
    return args.array().sort();
}

afunc("peach", "banana", "apple");
// -> [ "altered", "apple", "peach" ]

Alter arguments and apply them to another function.

function afunc()
{
    // Instantiate the arguments helper.
    const args = new Pargras(arguments);

    // Alter arguments.
    // a) Remove first argument.
    // b) Remove last argument.
    // c) Prepend argument 'one'.
    // d) Append argument 'four'.
    args.shift().pop().unshift('one').push('four');

    // Apply to console.log().
    args.applyTo(console.log);
}

afunc(1, 2, 3, 4);
// -> [ "one", 2, 3, "four" ]

More examples

Please refer to the test spec for more examples.

Testing

We use

Steps to be taken

  • Clone or download the repository.
  • Change into the project directory.
  • Use npm install to install all development dependencies.
  • Use npm runt lint to run static code analysis.
  • Use npm test to run the tests.
  • Use npm run coverage to track test coverage.
  • The output should display successful execution results and a code coverage map.

Build

  • Clone or download the repository.
  • Change into project directory.
  • Use npm run build in project directory to build pargras.min.js from pargras.js.

Contribution

Please use Github issues for requests.

Pull requests are welcome.

Issues

We use GitHub issues to track bugs. Please ensure your bug description is clear and has sufficient instructions to be able to reproduce the issue.

The absolute best way to report a bug is to submit a pull request including a new failing test which describes the bug. When the bug is fixed, your pull request can then be merged.

The next best way to report a bug is to provide a reduced test case on jsFiddle or jsBin or produce exact code inline in the issue which will reproduce the bug.

Support

Changelog

v1.1.0

  • Update npm modules.
  • Update and extend test environment.
  • Add static code analysis tool JSHint.
  • Add Karma test runner.
  • Fix JSHint issues.
  • Replace uglify-js by terser for minification.
  • Update README.

v1.0.3

  • Update npm modules.

v1.0.2

  • Update npm modules.

v1.0.1

  • Update npm modules.

v1.0.0

  • Initial public release

License

Copyright (c) 2016-present, tbillenstein. Pargras is licensed under the MIT License.