Superoverload
Superoverload is a function overload for JavaScript.
Usage
Superoverload expects functions and their signatures as arguments. Like this:
const overload = ; const fn = ; ; // => 'It is a number'; // => 'It is a string'
You can pass odd number of arguments, then the fisrt will be interpreted as default function. Default means, that it will be called if all over functions do not have corresponding signature.
const overload = ; const fn = ; ; // => 'It is a number'; // => 'It is something else'
Optional parameters
Superoverload can be used to declare optional parameters.
{ return protocol + '://' + host + port ? ':' + port : '' + path;} const getUrl = ; ; // => 'http://example.com/path'; // => 'http://my.example.com:8080/somepath'