Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
node function signature parser
branch: master

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
LICENSE
README.md
index.js
package.json
test.js

README.md

Basic Usage

Argue determines the argument signature received by a function.

var argue = require('argue');

function foo() {
  var sig = argue(arguments);
  switch(sig) {
    case 'sbnf':
      var mystr = arguments[0];
      var mybool = arguments[1];
      var mynum = arguments[2];
      var myfunv = arguments[3];
      // we got a string, boolean, number, and function
      break;

    case 'nnnn':
      // we got four numbers
      break;

    case 'ord-':
      // we got an object, regexp, date, and null
      break;

    default:
      // you get the idea
  }
}

Argue returns the following characters for the following types:

d : Date

a : Array

r : RegExp

e : Error

s : String

b : Boolean

n : Number

o : Object

f : Function

- : null

u : undefined

Something went wrong with that request. Please try again.