{"id":30663451,"url":"https://github.com/simpsonresearch/better-variable-management","last_synced_at":"2026-02-11T23:18:41.235Z","repository":{"id":304235214,"uuid":"1018192132","full_name":"simpsonresearch/better-variable-management","owner":"simpsonresearch","description":null,"archived":false,"fork":false,"pushed_at":"2025-07-11T19:27:35.000Z","size":5,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-08-31T17:17:17.128Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"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/simpsonresearch.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-07-11T19:12:20.000Z","updated_at":"2025-07-11T19:27:38.000Z","dependencies_parsed_at":"2025-07-11T21:15:36.003Z","dependency_job_id":"b126e751-f8b8-4823-8cc8-58e96ff53f86","html_url":"https://github.com/simpsonresearch/better-variable-management","commit_stats":null,"previous_names":["simpson-computer-technologies-research/better-variable-management","simpsonresearch/better-variable-management"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/simpsonresearch/better-variable-management","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpsonresearch%2Fbetter-variable-management","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpsonresearch%2Fbetter-variable-management/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpsonresearch%2Fbetter-variable-management/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpsonresearch%2Fbetter-variable-management/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simpsonresearch","download_url":"https://codeload.github.com/simpsonresearch/better-variable-management/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simpsonresearch%2Fbetter-variable-management/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29239935,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-08T18:06:38.086Z","status":"ssl_error","status_checked_at":"2026-02-08T18:06:09.124Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2025-08-31T17:11:22.948Z","updated_at":"2026-02-11T23:18:41.195Z","avatar_url":"https://github.com/simpsonresearch.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# better-code\n\nWas watching a video, noticed bad code. Here are improvements.\n\n## Commenting in code\n\nComments are great for managing code context. \n\nFor example, having these three comments (below) helps developers understand the context of each code blob. \n\nOf course it's good to move these code blobs into different functions (i.e. get_user, check_user, update_user), BUT, in some conditions (i.e. a lot of state/parameter variables in React) that can make the code ALOT more difficult to read, understand, and track.\n\n```js\nfn veriryUser() {\n   // Get user\n   {blob of code}\n\n  // Check user\n  {blob of code}\n\n  // Update user\n  {blob of code}\n}\n```\n\n## Objects vs. Arrays\n\n### BAD\n\nComments (and arrays + hardcoded indices) are difficult to maintain.\n\n```js\nconst array = [ ... ];\n\n// Is stats valid?\nif (array[367] === 1) {\n  ...\n}\n```\n\n### OKAY\n\nIf you still want to use arrays for memory + performance optimization.\n\n```js\nconst store = [ ... ] as const;\nconst STORE_INDEX_IS_STATS_VALID = 367;\n\nconst isStatsValid = store[STORE_INDEX_IS_STATS_VALID];\nif (isStatsValid) {\n  ...\n}\n```\n\n### EVEN BETTER\n\nUse a map/object for best DX.\n\n```js\nconst store = { ... } as const;\n\nif (store.isStatsValid) {\n  ...\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimpsonresearch%2Fbetter-variable-management","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimpsonresearch%2Fbetter-variable-management","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimpsonresearch%2Fbetter-variable-management/lists"}