const-func
v1.0.1
Published
Create a function always returning a constant
Downloads
11
Readme
const-func
Create a function always returning a constant
Install
npm install --save const-func
Usage
import always from 'const-func'
const alwaysUndefined = always()
alwaysUndefined()
// => undefined
const always3 = always(3)
always3()
// => 3
const alwaysHi = always('hi')
alwaysHi('whatever')
// => 'hi'
API
always(arg)
Returns a function that always returns a constant value.
arg
type: *
default: undefined
The constant value to always return from the constant function.
LICENSE
MIT © Dustin Specker