{"id":13452050,"url":"https://github.com/sanfilippopablo/babel-plugin-optimize-hook-destructuring","last_synced_at":"2025-03-23T19:33:30.792Z","repository":{"id":33229004,"uuid":"155590179","full_name":"sanfilippopablo/babel-plugin-optimize-hook-destructuring","owner":"sanfilippopablo","description":"Babel plugin for transforming this const [value, setValue] = useState(null) to this const {0: value, 1: setValue} = useState(null);.","archived":false,"fork":false,"pushed_at":"2022-12-08T18:58:09.000Z","size":181,"stargazers_count":44,"open_issues_count":10,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-12T19:06:44.559Z","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":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sanfilippopablo.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}},"created_at":"2018-10-31T16:33:34.000Z","updated_at":"2021-10-18T08:13:45.000Z","dependencies_parsed_at":"2023-01-15T00:00:36.337Z","dependency_job_id":null,"html_url":"https://github.com/sanfilippopablo/babel-plugin-optimize-hook-destructuring","commit_stats":null,"previous_names":["sanfilippopablo/babel-plugin-numeric-keys-array-destructure"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanfilippopablo%2Fbabel-plugin-optimize-hook-destructuring","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanfilippopablo%2Fbabel-plugin-optimize-hook-destructuring/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanfilippopablo%2Fbabel-plugin-optimize-hook-destructuring/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sanfilippopablo%2Fbabel-plugin-optimize-hook-destructuring/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sanfilippopablo","download_url":"https://codeload.github.com/sanfilippopablo/babel-plugin-optimize-hook-destructuring/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245158940,"owners_count":20570290,"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-07-31T07:01:11.298Z","updated_at":"2025-03-23T19:33:30.435Z","avatar_url":"https://github.com/sanfilippopablo.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# babel-plugin-optimize-hook-destructuring\n\nBabel plugin for transforming this `const [value, setValue] = useState(null)` to this `const {0: value, 1: setValue} = useState(null);`.\n\nNote that this plugin only convert hooks (function name starting with `use`).\n\n**input:**\n\n```js\nfunction Foo() {\n  // this gets converted to object destructuring:\n  const [count, setCount] = useState(0);\n\n  // but non-hook calls are not modified:\n  const [a, b] = [0, 1];\n  const [c, d] = otherThings();\n  const f = 0;\n}\n```\n\n**output:**\n\n```js\nfunction Foo() {\n  // this gets converted to object destructuring:\n  const { 0: count, 1: setCount } = useState(0);\n\n  // but non-hook calls are not modified:\n  const [a, b] = [0, 1];\n  const [c, d] = otherThings();\n  const f = 0;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanfilippopablo%2Fbabel-plugin-optimize-hook-destructuring","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsanfilippopablo%2Fbabel-plugin-optimize-hook-destructuring","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsanfilippopablo%2Fbabel-plugin-optimize-hook-destructuring/lists"}