{"id":23350838,"url":"https://github.com/e0selmy4v/func2code","last_synced_at":"2025-04-07T18:21:50.424Z","repository":{"id":65281272,"uuid":"589014681","full_name":"E0SelmY4V/func2code","owner":"E0SelmY4V","description":"Turn functions into strings","archived":false,"fork":false,"pushed_at":"2023-07-04T16:21:46.000Z","size":59,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-06T12:42:01.978Z","etag":null,"topics":["code","convert","converter","func","function","inline","inner","parser","source"],"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/E0SelmY4V.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-14T19:32:29.000Z","updated_at":"2023-01-14T20:25:47.000Z","dependencies_parsed_at":"2024-10-27T11:47:12.637Z","dependency_job_id":"451a04d3-1227-4e6c-838a-eef95cd56f36","html_url":"https://github.com/E0SelmY4V/func2code","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/E0SelmY4V%2Ffunc2code","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/E0SelmY4V%2Ffunc2code/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/E0SelmY4V%2Ffunc2code/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/E0SelmY4V%2Ffunc2code/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/E0SelmY4V","download_url":"https://codeload.github.com/E0SelmY4V/func2code/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247704579,"owners_count":20982299,"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":["code","convert","converter","func","function","inline","inner","parser","source"],"created_at":"2024-12-21T08:18:55.646Z","updated_at":"2025-04-07T18:21:50.397Z","avatar_url":"https://github.com/E0SelmY4V.png","language":"JavaScript","readme":"# Function to Code\n\n[![github action](https://github.com/E0SelmY4V/func2code/actions/workflows/test.yml/badge.svg)](https://github.com/E0SelmY4V/func2code/actions)\n[![codecov](https://codecov.io/gh/E0SelmY4V/func2code/branch/master/graph/badge.svg?token=LAZE5B30HX)](https://codecov.io/gh/E0SelmY4V/func2code)\n\n*func2code*'s main usage is to get the inner code of a function.\n\nAs a by-product, *func2code* can also get various information of the function, like params, name and name-code.\n\n## Import\n\n### ESM\n\n```ts\nimport func2code from 'func2code';\n```\n\n### CJS\n\n```js\nconst func2code = require('func2code');\n```\n\n### HTML\n\n```html\n\u003cscript src=\"func2code/index.js\"\u003e\u003c/script\u003e\n\u003cscript\u003e\n  /// \u003creference path=\"func2code/global.d.ts\" /\u003e\n  console.log(func2code);\n\u003c/script\u003e\n```\n\n## Usage\n\n```js\n// Input\nfunc2code.getInnerCode(()=\u003e1+1);\n\n// Output\n'return 1+1;'\n```\n\n```js\n// Input\nfunc2code.split(async function abc(\n  a, k,\n  {[`${[1,2,3].join('')}`]: b},\n  [c, d]\n) {\n  return 1 + 2;\n});\n\n// Output\n{\n  params: [\n    'a',\n    'k',\n    \"{[`${[1,2,3].join('')}`]: b}\",\n    '[c, d]'\n  ],\n  innerCode: '\\n  return 1 + 2;\\n',\n  nameCode: '\"abc\"',\n  name: 'abc',\n  isArrow: false,\n  isAsync: true,\n  isGetter: false,\n  isSetter: false,\n  isGenerator: false\n}\n```\n\n```js\n// Input\nfunc2code.getNameCode({\n  ['n'+`${(()=\u003e1+1)[[\n    'to',\n    'St',\n    'ri',\n    'ng',\n  ].join('')]()}`+123](n) {\n    return n + 1;\n  }\n}['n()=\u003e1+1123'])\n\n// Output\n\"'n'+`${(()=\u003e1+1)[[ 'to', 'St', 'ri', 'ng', ].join('')]()}`+123\"\n```\n\n[See all the test cases](https://github.com/E0SelmY4V/func2code/blob/master/test/fn.js)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe0selmy4v%2Ffunc2code","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fe0selmy4v%2Ffunc2code","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fe0selmy4v%2Ffunc2code/lists"}