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

Package detail

is-fn

sindresorhus512.8kMIT3.0.0

Check if a value is a function

function, fn, check, detect, is, test, type

readme

is-fn

Check if a value is a function

In Node.js, just use typeof fn which works exactly the same. This module can be useful in the browser where typeof fn has a myriad of bugs.

Install

$ npm install is-fn

Usage

import isFunction from 'is-fn';

isFunction(() => {});
//=> true

isFunction('unicorn');
//=> false