‚̧N00b's Programming Machine
    Have ideas to improve npm?Join in the discussion! ¬Ľ

    is-function-x

    4.1.2¬†‚Äʬ†Public¬†‚Äʬ†Published

    Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

    is-function-x

    Determine whether a given value is a function object.

    module.exports(value, [allowClass]) ‚áí boolean ‚ŹŹ

    Checks if value is classified as a Function object.

    Kind: Exported function
    Returns: boolean - Returns true if value is correctly classified, else false.

    Param Type Default Description
    value * The value to check.
    [allowClass] boolean false Whether to filter ES6 classes.

    Example

    import isFunction from 'is-function-x';
     
    console.log(isFunction()); // false
    console.log(isFunction(Number.MIN_VALUE)); // false
    console.log(isFunction('abc')); // false
    console.log(isFunction(true)); // false
    console.log(isFunction({name: 'abc'})); // false
    console.log(isFunction(function() {})); // true
    console.log(isFunction(new Function())); // true
    console.log(isFunction(function* test1() {})); // true
    console.log(isFunction(function test2(a, b) {})); // true
    console.log(isFunction(async function test3() {})); // true
    console.log(isFunction(class Test {})); // false
    console.log(isFunction(class Test {}, true)); // true
    console.log(
      isFunction((x, y) => {
        return this;
      }),
    ); // true

    Install

    npm i is-function-x

    DownloadsWeekly Downloads

    8,718

    Version

    4.1.2

    License

    MIT

    Unpacked Size

    188 kB

    Total Files

    11

    Last publish

    Collaborators

    • avatar