{"id":24558157,"url":"https://github.com/rse/func-params","last_synced_at":"2025-03-16T19:23:10.982Z","repository":{"id":57242887,"uuid":"121163433","full_name":"rse/func-params","owner":"rse","description":"Run-Time Function Parameter Name Determination","archived":false,"fork":false,"pushed_at":"2021-01-09T10:28:13.000Z","size":24,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-10T10:46:44.679Z","etag":null,"topics":["function","javascript","name","parameter","run-time"],"latest_commit_sha":null,"homepage":"http://npmjs.com/func-params","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rse.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-11T20:21:32.000Z","updated_at":"2021-10-03T19:14:22.000Z","dependencies_parsed_at":"2022-09-15T00:50:38.432Z","dependency_job_id":null,"html_url":"https://github.com/rse/func-params","commit_stats":null,"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Ffunc-params","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Ffunc-params/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Ffunc-params/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rse%2Ffunc-params/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rse","download_url":"https://codeload.github.com/rse/func-params/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243918641,"owners_count":20368745,"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":["function","javascript","name","parameter","run-time"],"created_at":"2025-01-23T05:47:32.277Z","updated_at":"2025-03-16T19:23:10.949Z","avatar_url":"https://github.com/rse.png","language":"JavaScript","readme":"\nfunc-params\n===========\n\nRun-Time Function Parameter Name Determination\n\n\u003cp/\u003e\n\u003cimg src=\"https://nodei.co/npm/func-params.png?downloads=true\u0026stars=true\" alt=\"\"/\u003e\n\n\u003cp/\u003e\n\u003cimg src=\"https://david-dm.org/rse/func-params.png\" alt=\"\"/\u003e\n\nAbout\n-----\n\nThis is a tiny JavaScript function for determining the names of the\nparameters of a function under run-time. It can be used as the building\nblock for Dependency Injection or Named-Parameter implementations.\nThe underlying problem is that there is no official JavaScript API\nto determine the names of the parameters of a function under run-time,\nexcept the ECMAScript 2015 `Function.prototype.toString()`. This\nlibrary determines the names of the function parameters by parsing\nthe source code of `Function.prototype.toString()`. Its parsing is not\n100%, but is able to handle even complex syntax scenarios.\n\nInstallation\n------------\n\n```shell\n$ npm install func-params\n```\n\nUsage\n-----\n\n```js\nconst funcParams = require(\"func-params\")\n\n/*  simple example  */\nfuncParams(function (a, b, c, d) {})\n// --\u003e [ \"a\", \"b\", \"c\", \"d\" ]\n\n/*  complex example  */\nfuncParams(function (\n    a /* x,y */ = /* x,y */ `foo\\`baz${bar + \",)\" + (42 / 7)}bar`,\n    b = x(42, 7),\n    c = { foo: { bar: x(42, 7), baz: [ 2 / 3 ] } },\n    d = 42\n) {})\n// --\u003e [ \"a\", \"b\", \"c\", \"d\" ]\n```\n\nLicense\n-------\n\nCopyright (c) 2018-2021 Dr. Ralf S. Engelschall (http://engelschall.com/)\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be included\nin all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.\nIN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY\nCLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,\nTORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE\nSOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Ffunc-params","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frse%2Ffunc-params","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frse%2Ffunc-params/lists"}