fn-args

Get the arguments of a function, arrow function, generator function, async function

Usage no npm install needed!

<script type="module">
  import fnArgs from 'https://cdn.skypack.dev/fn-args';
</script>

README

fn-args

Get the arguments of a function, arrow function, generator function, async function

Install

$ npm install fn-args

Usage

import functionArguments from 'fn-args';

functionArguments(function (foo, bar) {});
//=> ['foo', 'bar']

functionArguments((foo, bar) => {});
//=> ['foo', 'bar']

functionArguments(function * (foo, bar) {});
//=> ['foo', 'bar']

functionArguments(async function (foo, bar) {});
//=> ['foo', 'bar']