Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

assert-function

bendrucker4.5kMIT1.0.0

Assert that a value is a function

assert, function, error

readme

assert-function Build Status

Assert that a value is a function

Install

$ npm install --save assert-function

Usage

var assertFunction = require('assert-function')

assertFunction(function () {})
//=> noop

assertFunction('foo')
// => TypeError: Expected function, got: foo

API

assertFunction(value) -> undefined

value

Required
Type: any

A value to check. A TypeError is throw for non-function values.

License

MIT © Ben Drucker