Defined Args
A small utility for grabing arguments of a specified type.
Inspired from tblobaum's rconsole's defined method
Usage
Node.js
var da =
Browser
Methods
In all methods, type
, can be matched against the following built in types: null
, undefined
, boolean
, array
, function
, date
, regexp
, number
, string
, and object
. The param is not case sensitive.
first(type, …)
Returns the first argument of the specified type
da // 'a'dafirst // 1
last(type, …)
Returns the last argument of the specified type
da // {foo: 'bar'}dalast // false
not(type, …)
Returns the first type that does not match the specified type
da // 'a'danot // undefined
Aliases
All top level methods, (first
, last
, not
), have an alias to the built in types checked against.
method.null
method.string
method.undefined
method.number
method.function
method.boolean
method.date
method.regexp
method.object
method.array
Install
With npm
npm install da