npm.io
1.0.1 • Published 4 years ago

@gustavofsantos/defn

Licence
ISC
Version
1.0.1
Deps
0
Size
3 kB
Vulns
0
Weekly
0

defn

Utilitary function to define functions with multiple implementations.

Getting Started

Install this package using your favorite package manager:

$ npm i @gustavofsantos/defn

Then define your first variadic function.

const greet = defn(
  () => "Hello you",
  (name) => `Hello, ${name}`
)

greet() // Hello you
greet('Gustavo') // Hello, Gustavo