1.0.4 • Published 10 years ago

overloading v1.0.4

Weekly downloads
6
License
MIT
Repository
github
Last release
10 years ago

overloading

Define complex overloads for functions! Errors are thrown if no matching overload is found.

##Example

var overloading = require('overloading');
var fooOverloads = overloading([
  [Function],
  [String, String]
]); 

function foo(one, two){
  switch(fooOverloads.find(arguments)){
    case 0:one();break;
    case 1:console.log(one + ' ' + two);break;
  }
}

foo('hello', 'world!');
//prints "hello world!"
foo(foo.bind(null, 'say', 'what?'));
//prints "say what?"
1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago