Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vargs

Package Overview
Dependencies
Maintainers
0
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vargs

practical variable argument handling

  • 0.1.0
  • latest
  • npm
  • Socket score

Maintainers
0
Created
Source

vargs

variable argument handling for functions taking a callback

rationale

JavaScript has very poor argument handling. vargs tries to make it simpler.

synopsis

var Args = require("vargs").Constructor;

function (/* [arg1, arg2, ...][,callback] */) {
    var args = new(Args)(arguments);
    
    args.first;    // first argument
    args.last;     // last argument before callback
    args.callback; // callback argument, or an empty function
    args.all;      // all arguments except callback
    args.length;   // number of arguments, not including callback
    
    args.callbackGiven(); // returns true or false
    args.at(-1);          // last argument, including callback
    args.array;           // all arguments, including callback
}

example

For a real-world example of vargs, check http://github.com/cloudhead/cradle

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc