const-func

1.0.1 • Public • Published

const-func

NPM version Build Status Coverage Status

Code Climate Dependencies DevDependencies

Create a function always returning a constant

Like Elm's always

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

Readme

Keywords

Package Sidebar

Install

npm i const-func

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • dustinspecker