Skip to content

Instantly share code, notes, and snippets.

@burdiuz
Last active May 28, 2018 17:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save burdiuz/553f12cdf2d9dd2a9a8625b8de09fb7a to your computer and use it in GitHub Desktop.
Save burdiuz/553f12cdf2d9dd2a9a8625b8de09fb7a to your computer and use it in GitHub Desktop.
Is value a function check

isFunction

The isFunction() is a simple wrapper over

typeof value === 'function'

Previously I was using instanceof but it seems using typeof should faster. And since I do not like putting string literal here and there, I've decided to wrap it into a function.

'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
const isFunction = (target) => (typeof target === 'function');
exports.isFunction = isFunction;
exports.default = isFunction;
{
"name": "@actualwave/is-function",
"description": "Is value a function check",
"version": "0.0.1",
"main": "is-function.js",
"keywords": [
"js",
"javascript",
"Function",
"instanceof",
"typeof",
"type",
"check"
],
"homepage": "https://gist.github.com/burdiuz/553f12cdf2d9dd2a9a8625b8de09fb7a",
"bugs": {
"url": "https://gist.github.com/burdiuz/553f12cdf2d9dd2a9a8625b8de09fb7a",
"email": "burdiuz@gmail.com"
},
"license": "MIT",
"author": "Oleg Galaburda <burdiuz@gmail.com> (http://actualwave.com/)"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment