Start sharing components as a team!Share components as a team!Join Bit to build your applications faster.Get Started Free

is-function

v4.17.15arrow_drop_down
v4.17.15
v4.17.11
STATUS
Passing
DOWNLOADS
2,235
LICENSE
MIT
VISIBILITY
Public
PUBLISHED
2 months ago
SIZE
485 B
Checks if `value` is classified as a `Function` object.
2 contributors
Install is-function as a package?
Copied
npm i @bit/lodash.lodash.is-function
Set Bit as a scoped registryLearn more
npm config set '@bit:registry' https://node.bit.dev
Files
isFunction.js
33 Lines(4 sloc)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34

/**
 * Checks if `value` is classified as a `Function` object.
 *
 * @since 0.1.0
 * @category Lang
 * @param {*} value The value to check.
 * @returns {boolean} Returns `true` if `value` is a function, else `false`.
 * @example
 *
 * isFunction(class Any{})
 * // => true
 *
 * isFunction(() => {})
 * // => true
 * 
 * isFunction(async () => {})
 * // => true
 * 
 * isFunction(function * Any() {})
 * // => true
 * 
 * isFunction(Math.round)
 * // => true
 * 
 * isFunction(/abc/)
 * // => false
 */
function isFunction(value) {
  return typeof value === 'function'
}

export default isFunction