deus
arguments convention over configuration
A little bit of functional programming to have a single function implementation whatever the arguments exists or their order.
Installation
with component:
$ component install bredele/deus
with nodejs:
$ npm install deus
Usage
It's a bit complicated to explain with words, so hopefully the example below speaks for itself.
create a function with deus:
// specify the arguments types (have to be different)var init = ;
deus preserves the arguments:
;// => name: olivier// => data: bredele
deus doesn't care if an argument is missing:
;// => name: undefined// => data: bredele
deus allows you to switch the arguments order:
;// => name: olivier// => data: bredele
deus preseves the other arguments:
var other = ;;// => olivier
Deus decreases the number of decisions the developer needs to make because the implementation is the same whatever the arguments are. The returned function is flexible and yet simple.