Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/zkochan/dfun

Optional parameters, default values and type-checking for your JavaScript method signatures
https://github.com/zkochan/dfun

Last synced: 29 days ago
JSON representation

Optional parameters, default values and type-checking for your JavaScript method signatures

Awesome Lists containing this project

README

        

# dfun
Optional parameters, default values and type-checking for your JavaScript method signatures

##Example
Lets creata a function that can accept 3 parameters one of which is optional.
```js
var foo = dfun(Number, [String, 'bar'], Number, function (a, b, c) {
console.log(a + b + c);
});

foo(1, 'baz', 2); // outputs 1 baz 2
foo(1, 2); // outputs 1 bar 2
```

License
========

The MIT License (MIT)