{"id":13624374,"url":"https://github.com/chasefleming/enum-xyz","last_synced_at":"2025-03-22T02:31:42.083Z","repository":{"id":41771020,"uuid":"459421363","full_name":"chasefleming/enum-xyz","owner":"chasefleming","description":"Flexible JavaScript enums using ES6 Proxies.","archived":false,"fork":false,"pushed_at":"2023-08-23T00:06:50.000Z","size":629,"stargazers_count":39,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-12T05:53:58.577Z","etag":null,"topics":["enum","enums","javascript"],"latest_commit_sha":null,"homepage":"","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/chasefleming.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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}},"created_at":"2022-02-15T04:03:25.000Z","updated_at":"2025-02-11T15:51:36.000Z","dependencies_parsed_at":"2024-08-01T21:44:45.632Z","dependency_job_id":"7e550177-de49-4c74-a49e-dabd22813047","html_url":"https://github.com/chasefleming/enum-xyz","commit_stats":{"total_commits":27,"total_committers":3,"mean_commits":9.0,"dds":0.07407407407407407,"last_synced_commit":"3a4dc012b5705a8319420539871a5b0895957244"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chasefleming%2Fenum-xyz","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chasefleming%2Fenum-xyz/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chasefleming%2Fenum-xyz/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chasefleming%2Fenum-xyz/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chasefleming","download_url":"https://codeload.github.com/chasefleming/enum-xyz/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244898185,"owners_count":20528331,"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":["enum","enums","javascript"],"created_at":"2024-08-01T21:01:41.873Z","updated_at":"2025-03-22T02:31:41.773Z","avatar_url":"https://github.com/chasefleming.png","language":"JavaScript","funding_links":[],"categories":["javascript","Proxy Resources"],"sub_categories":["Modules"],"readme":"# enum-xyz\n\n`enum-xyz` offers a way to generate enums in JavaScript leveraging the power of Proxies. It supports various casing styles, transformations, and other customization options.\n\n\u003e Based on [this tweet](https://twitter.com/2ality/status/1486139713354448897)\n\n[![ENUM-XYZ Continuous Integration](https://github.com/chasefleming/enum-xyz/actions/workflows/integrate.yml/badge.svg)](https://github.com/chasefleming/enum-xyz/actions/workflows/integrate.yml)\n\n\u003e Note: This library is not yet at version 1.0.0. As such, breaking changes may occur in subsequent releases. Please ensure you read the release notes when updating.\n\n## Install\n\n```\n$ npm install enum-xyz --save\n```\n\n## Usage\n\n### String Enums\n\n```\nimport Enum from \"enum-xyz\";\n\nconst { Summer, Autumn, Winter, Spring } = Enum.String();\n\nconsole.log(Summer); // Outputs: \"Summer\"\n```\n\n#### Options for String Enums:\n\n- `casing`: Transforms the string based on the specified casing style. Available options are `snakeCase`, `camelCase`, `PascalCase`, `kebabCase`, `lowercase`, and `uppercase`.\n- `transform`: Provide a custom function to transform the enum values. This function takes the original value and returns a transformed value.\n\n##### Example:\n\n```\nconst { userId, userAddress } = Enum.String({ casing: 'kebabCase' });\nconsole.log(userId); // Outputs: \"user-id\"\n\nconst options = {\n  casing: 'kebabCase',\n  transform: (value) =\u003e `https://api.example.com/${value}`\n};\nconst { userEndpoint, orderEndpoint } = Enum.String(options);\nconsole.log(userEndpoint); // Outputs: \"https://api.example.com/user-endpoint\"\n```\n\n### Numeric Enums\n\nStarts from 0 by default:\n\n```\nimport Enum from \"enum-xyz\";\n\nconst { A, B, C, D } = Enum.Numeric();\n\nconsole.log(A); // Outputs: 0\n```\n\n#### Options for Numeric Enums:\n\n- `startIndex`: Start the numeric enum from a specific index.\n- `step`: Increment the numeric values by a specific step (e.g., 2, 5, 10).\n\n##### Example:\n\n```\nconst { A, B, C } = Enum.Numeric({ startIndex: 5, step: 2 });\nconsole.log(A); // Outputs: 5\nconsole.log(B); // Outputs: 7\n```\n\n### Symbol Enums\n\n```\nimport Enum from \"enum-xyz\";\n\nconst { blue, red } = Enum.Symbol();\n\nconsole.log(blue); // Outputs: Symbol(blue)\n```\n\n#### Options for Symbol Enums:\n\n- `global`: Create a global symbol using Symbol.for().\n\n##### Example:\n\n```\nconst { blueGlobal } = Enum.Symbol({ global: true });\nconsole.log(blueGlobal); // Outputs: Symbol.for('blueGlobal')\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchasefleming%2Fenum-xyz","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchasefleming%2Fenum-xyz","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchasefleming%2Fenum-xyz/lists"}