data_is-function.js

/**
 * @module isFunction
 * @description Determines if the specified functionToCheck is a function.
 *
 * @since 1.0.0
 *
 * @param {*} functionToCheck The item to be tested.
 *
 * @return {boolean} Returns true if the specified functionToCheck is a function. Returns false otherwise.
 *
 * @example
 * import { isFunction } from "@gravityforms/utils";
 *
 * function Example() {
 *   const isFunction = isFunction( fn1 );
 * }
 * function fn1() {
 * 	 return 1;
 * }
 *
 */
export default function( functionToCheck ) {
	return functionToCheck && {}.toString.call( functionToCheck ) === '[object Function]';
}