New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@alesmenzel/function-arguments

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@alesmenzel/function-arguments

Parse function arguments

latest
npmnpm
Version
1.1.0
Version published
Maintainers
1
Created
Source

Function arguments

Parses function arguments and returns an array of parameter names. Uses AST parser acorn and can handle functions with default parameters.

Instalation

npm i @alesmenzel/function-arguments

Usage

Can parse ES5 named and unamed functions as well as ES6 arrow funtions and shorthand arrow functions.

const functionArguments = require('@alesmenzel/function-arguments');


// ES5
const subject = function x(a, b, c) {};

functionArguments(subject);
// ["a", "b", "c"]


// ES6
const subject = (a, b = 15, c) => {};

functionArguments(subject);
// ["a", "b", "c"]


// ES6 shorthand
const subject = a => a;

functionArguments(subject);
// ["a"]

Keywords

function

FAQs

Package last updated on 27 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts