get-function-args-x

3.1.2 • Public • Published

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

get-function-args-x

Get the args of the function.

module.exports(fn)undefined | Array

This method returns the args of the function, or undefined if not a function.

Kind: Exported function
Returns: undefined | Array - The args of the function, or undefined if not a function.

Param Type Description
fn function The function to get the args of.

Example

import getFunctionArgs from 'get-function-args-x';
 
getFunctionArgs(); // undefined
getFunctionArgs(Number.MIN_VALUE); // undefined
getFunctionArgs('abc'); // undefined
getFunctionArgs(true); // undefined
getFunctionArgs({name: 'abc'}); // undefined
getFunctionArgs(function() {}); // []
getFunctionArgs(new Function()); // []
getFunctionArgs(function test() {}); // []
getFunctionArgs(function test(a, b) {}); // ['a', 'b']
getFunctionArgs(function* test(a, b) {}); // ['a', 'b']
getFunctionArgs((a, b) => {}); // ['a', 'b']
getFunctionArgs(async function test(a, b) {}); // ['a', 'b']

/get-function-args-x/

    Package Sidebar

    Install

    npm i get-function-args-x

    Weekly Downloads

    33

    Version

    3.1.2

    License

    MIT

    Unpacked Size

    284 kB

    Total Files

    11

    Last publish

    Collaborators

    • xotic750