{"id":15365484,"url":"https://github.com/tunnckocore/function-arguments","last_synced_at":"2025-10-25T19:32:12.595Z","repository":{"id":48020570,"uuid":"54171402","full_name":"tunnckoCore/function-arguments","owner":"tunnckoCore","description":"Get function arguments, useful for and used in dependency injectors. Works for regular functions, generator functions and arrow functions.","archived":false,"fork":false,"pushed_at":"2023-01-11T22:26:56.000Z","size":413,"stargazers_count":20,"open_issues_count":11,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-11T12:43:31.736Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tunnckoCore.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null},"funding":{"ko_fi":"tunnckoCore","custom":["https://gumroad.com/l/tunnckoCoreRecurringDonation"]}},"created_at":"2016-03-18T03:36:36.000Z","updated_at":"2024-10-06T03:49:21.000Z","dependencies_parsed_at":"2023-02-09T08:31:36.877Z","dependency_job_id":null,"html_url":"https://github.com/tunnckoCore/function-arguments","commit_stats":null,"previous_names":[],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnckoCore%2Ffunction-arguments","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnckoCore%2Ffunction-arguments/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnckoCore%2Ffunction-arguments/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tunnckoCore%2Ffunction-arguments/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tunnckoCore","download_url":"https://codeload.github.com/tunnckoCore/function-arguments/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248990571,"owners_count":21194776,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-01T13:14:52.330Z","updated_at":"2025-10-25T19:32:12.538Z","avatar_url":"https://github.com/tunnckoCore.png","language":"JavaScript","funding_links":["https://ko-fi.com/tunnckoCore","https://gumroad.com/l/tunnckoCoreRecurringDonation"],"categories":[],"sub_categories":[],"readme":"# function-arguments [![npm version][npmv-img]][npmv-url] [![github release][github-release-img]][github-release-url] [![License][license-img]][license-url]\n\n\u003e Get arguments of a function, useful for and used in dependency injectors. Works for regular functions, generator functions and arrow functions.\n\n[![code style][standard-img]][standard-url]\n[![linux build][travis-img]][travis-url]\n[![code coverage][coverage-img]][coverage-url]\n[![dependency status][david-img]][david-url]\n[![npm downloads][downloads-img]][downloads-url]\n[![paypal donate][paypalme-img]][paypalme-url]\n\n## Install\n\u003e Install with [npm](https://www.npmjs.com/)\n\n```\n$ npm i function-arguments --save\n```\n\n_**Important:** for more advanced stuff please use [parse-function][], don't suggest features or complex bugs._\n\n## Usage\n\u003e For more use-cases see the [tests](./test.js)\n\n```js\nconst functionArguments = require('function-arguments')\n```\n\n## API\n\n### [functionArguments](index.js#L33)\n\u003e Get function arguments names.\n\n**Params**\n\n* `fn` **{Function}**: Function from which to get arguments names.\n* `returns` **{Array}**\n\n**Example**\n\n```js\nvar fnArgs = require('function-arguments')\n\nconsole.log(fnArgs(function (a, b, c) {})) // =\u003e [ 'a', 'b', 'c' ]\nconsole.log(fnArgs(function named (a , b, c) {})) // =\u003e [ 'a', 'b', 'c' ]\n\nconsole.log(fnArgs(a =\u003e {})) // =\u003e [ 'a' ]\nconsole.log(fnArgs((a, b) =\u003e {})) // =\u003e [ 'a', 'b' ]\n\nconsole.log(fnArgs(function * (a ,b, c) {})) // =\u003e [ 'a', 'b', 'c' ]\nconsole.log(fnArgs(function * named (a ,b, c) {})) // =\u003e [ 'a', 'b', 'c' ]\n```\n\n### Works when using comments\n\u003e As it works for ES2015, it also works if you use comments in weird places.\n\n```js\nconsole.log(fnArgs(function /* something may */ (\n  // go,\n  go,\n  /* wrong, */\n  here\n  // (when, using, comments) {}\n) { return 1 })) // =\u003e [ 'go', 'here' ]\n```\n\n## Related\n- [flatten-arguments](https://www.npmjs.com/package/flatten-arguments): Fastest, simplest and smallest. Pass `arguments` object or list of… [more](https://github.com/tunnckocore/flatten-arguments#readme) | [homepage](https://github.com/tunnckocore/flatten-arguments#readme \"Fastest, simplest and smallest. Pass `arguments` object or list of arguments and get flattened array.\")\n- [fn-args](https://www.npmjs.com/package/fn-args): Get the arguments of a function | [homepage](https://github.com/sindresorhus/fn-args \"Get the arguments of a function\")\n- [fn-name](https://www.npmjs.com/package/fn-name): Get the name of a named function | [homepage](https://github.com/sindresorhus/fn-name \"Get the name of a named function\")\n- [get-fn-name](https://www.npmjs.com/package/get-fn-name): Get function name with strictness and correctness in mind. Also… [more](https://github.com/tunnckocore/get-fn-name#readme) | [homepage](https://github.com/tunnckocore/get-fn-name#readme \"Get function name with strictness and correctness in mind. Also works for arrow functions and getting correct name of bounded functions. Powered by [fn-name][].\")\n- [handle-arguments](https://www.npmjs.com/package/handle-arguments): Get separately non-callback arguments in `.arguments` and the last argument… [more](https://github.com/hybridables/handle-arguments#readme) | [homepage](https://github.com/hybridables/handle-arguments#readme \"Get separately non-callback arguments in `.arguments` and the last argument if it [is-callback-function][] in `.callback`. It also works like [sliced][], but returns object with `.arguments` and `.callback` properties.\")\n- [manage-arguments](https://www.npmjs.com/package/manage-arguments): Prevents arguments leakage - managing arguments. From Optimization killers by… [more](https://github.com/tunnckocore/manage-arguments#readme) | [homepage](https://github.com/tunnckocore/manage-arguments#readme \"Prevents arguments leakage - managing arguments. From Optimization killers by Petka Antonov.\")\n- [parse-function](https://www.npmjs.com/package/parse-function): Parse a function, arrow function or string to object with… [more](https://github.com/tunnckocore/parse-function#readme) | [homepage](https://github.com/tunnckocore/parse-function#readme \"Parse a function, arrow function or string to object with name, args, params and body properties.\")\n\n## Contributing\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/tunnckoCore/function-arguments/issues/new).\nBut before doing anything, please read the [CONTRIBUTING.md](./CONTRIBUTING.md) guidelines.\n\n## [Charlike Make Reagent](http://j.mp/1stW47C) [![new message to charlike][new-message-img]][new-message-url] [![freenode #charlike][freenode-img]][freenode-url]\n\n[![tunnckoCore.tk][author-www-img]][author-www-url] [![keybase tunnckoCore][keybase-img]][keybase-url] [![tunnckoCore npm][author-npm-img]][author-npm-url] [![tunnckoCore twitter][author-twitter-img]][author-twitter-url] [![tunnckoCore github][author-github-img]][author-github-url]\n\n[fn-name]: https://github.com/sindresorhus/fn-name\n[is-callback-function]: https://github.com/tunnckocore/is-callback-function\n[sliced]: https://github.com/aheckmann/sliced\n\n[downloads-url]: https://www.npmjs.com/package/function-arguments\n[downloads-img]: https://img.shields.io/npm/dm/function-arguments.svg\n\n[travis-url]: https://travis-ci.org/tunnckoCore/function-arguments\n[travis-img]: https://img.shields.io/travis/tunnckoCore/function-arguments/master.svg\n\n[coverage-url]: https://coveralls.io/r/tunnckoCore/function-arguments\n[coverage-img]: https://img.shields.io/coveralls/tunnckoCore/function-arguments.svg\n\n[david-url]: https://david-dm.org/tunnckoCore/function-arguments\n[david-img]: https://img.shields.io/david/tunnckoCore/function-arguments.svg\n\n[standard-url]: https://github.com/feross/standard\n[standard-img]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg\n\n[author-www-url]: http://www.tunnckocore.tk\n[author-www-img]: https://img.shields.io/badge/www-tunnckocore.tk-fe7d37.svg\n\n[keybase-url]: https://keybase.io/tunnckocore\n[keybase-img]: https://img.shields.io/badge/keybase-tunnckocore-8a7967.svg\n\n[author-npm-url]: https://www.npmjs.com/~tunnckocore\n[author-npm-img]: https://img.shields.io/badge/npm-~tunnckocore-cb3837.svg\n\n[author-twitter-url]: https://twitter.com/tunnckoCore\n[author-twitter-img]: https://img.shields.io/badge/twitter-@tunnckoCore-55acee.svg\n\n[author-github-url]: https://github.com/tunnckoCore\n[author-github-img]: https://img.shields.io/badge/github-@tunnckoCore-4183c4.svg\n\n[freenode-url]: http://webchat.freenode.net/?channels=charlike\n[freenode-img]: https://img.shields.io/badge/freenode-%23charlike-5654a4.svg\n\n[new-message-url]: https://github.com/tunnckoCore/ama\n[new-message-img]: https://img.shields.io/badge/ask%20me-anything-green.svg\n\n\u003c!-- --\u003e\n\n[paypalme-url]: https://ko-fi.com/tunnckoCore\n[paypalme-img]: https://img.shields.io/badge/support-donate-brightgreen.svg\n\n[npmv-url]: https://www.npmjs.com/package/function-arguments\n[npmv-img]: https://img.shields.io/npm/v/function-arguments.svg?label=npm%20version\n\n[github-release-url]: https://github.com/tunnckoCore/function-arguments/releases/latest\n[github-release-img]: https://img.shields.io/github/tag/tunnckoCore/function-arguments.svg?label=github%20tag\n\n[license-url]: https://github.com/tunnckoCore/function-arguments/blob/master/LICENSE\n[license-img]: https://img.shields.io/badge/license-MIT-blue.svg\n\n[parse-function]: https://tunnckocore.com/opensource","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftunnckocore%2Ffunction-arguments","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftunnckocore%2Ffunction-arguments","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftunnckocore%2Ffunction-arguments/lists"}