{"id":24063999,"url":"https://github.com/qeepsake/rails-guid","last_synced_at":"2026-06-06T20:31:36.357Z","repository":{"id":57683474,"uuid":"478593290","full_name":"Qeepsake/rails-guid","owner":"Qeepsake","description":"Tiny utility to create and extract rails guid strings in JavaScript 🛤","archived":false,"fork":false,"pushed_at":"2023-09-27T10:44:39.000Z","size":772,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-10T00:46:32.541Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","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/Qeepsake.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}},"created_at":"2022-04-06T14:22:26.000Z","updated_at":"2022-04-06T17:15:12.000Z","dependencies_parsed_at":"2022-09-05T16:41:18.340Z","dependency_job_id":"3272f954-4878-4fec-9428-ae105983d25c","html_url":"https://github.com/Qeepsake/rails-guid","commit_stats":{"total_commits":25,"total_committers":3,"mean_commits":8.333333333333334,"dds":0.52,"last_synced_commit":"43f9634569578cc5865ab3887685e30c7f266dcd"},"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qeepsake%2Frails-guid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qeepsake%2Frails-guid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qeepsake%2Frails-guid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Qeepsake%2Frails-guid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Qeepsake","download_url":"https://codeload.github.com/Qeepsake/rails-guid/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240898698,"owners_count":19875237,"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":"2025-01-09T10:06:05.807Z","updated_at":"2025-02-26T17:20:37.667Z","avatar_url":"https://github.com/Qeepsake.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rails Guid for JavaScript\n\u003c!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --\u003e\n[![All Contributors](https://img.shields.io/badge/all_contributors-2-orange.svg?style=flat-square)](#contributors-)\n\u003c!-- ALL-CONTRIBUTORS-BADGE:END --\u003e\n\n\u003e Zero dependancy utility for creating and extracting rails GUIDs from a string.\n\n[![NPM](https://img.shields.io/npm/v/@qeepsake/rails-guid.svg)](https://www.npmjs.com/package/@qeepsake/rails-guid) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n## Install\n\n```bash\nnpm install --save @qeepsake/rails-guid\n```\n\n## Usage\n\n### Extracting Rails GUID\n\nYou can use `extractRailsId` to extract a Rails GUID from a string:\n\n```js\nimport { extractRailsId } from '@qeepsake/rails-guid';\n\nconst guid = \"gid://qeepsake-rails/Model/55587\";\nextractRailsId(guid) // -\u003e 55587\n```\n\n### Creating Rails GUID\n\nYou can use the `createRailsId` to create Rails GUID:\n\n```js\nimport { createRailsId } from '@qeepsake/rails-guid';\n\nconst id = 55587 || \"55587\";\ncreateRailsId(id, \"Model\") // -\u003e gid://qeepsake-rails/Model/55587\n```\n\n### Tetsing for Extracted Rails ID\n\n```js\nimport { isExtractedRailsId } from '@qeepsake/rails-guid';\n\nisExtractedRailsId(\"55587\") // =\u003e true\nisExtractedRailsId(\"gid://qeepsake-rails/Model/55587\") // =\u003e false\n```\n\n### Testing for Rails Global ID\n\nYou can use `isRailsId`` to test if a string is a valid Rails Global ID:\n\n```js\nimport { isRailsId } from '@qeepsake/rails-guid';\n\nisRailsId(\"gid://qeepsake-rails/User/1\")  // =\u003e true\nisRailsId(\"gid://someotherapp/User/1\")   // =\u003e true\nisRailsId(\"User/1\")                      // =\u003e false\n```\n\nThis function tests if the string conforms to the general Rails gid structure: `gid://\u003cANY_APP_NAME\u003e/\u003cMODEL_NAME\u003e/\u003cID\u003e`.\n\n## License\n\nMIT © [lukebrandonfarrell](https://github.com/lukebrandonfarrell)\n\n## Contributors ✨\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"http://www.lukebrandonfarrell.com\"\u003e\u003cimg src=\"https://avatars3.githubusercontent.com/u/18139277?v=4\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eLuke Brandon Farrell\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"#projectManagement-lukebrandonfarrell\" title=\"Project Management\"\u003e📆\u003c/a\u003e \u003ca href=\"https://github.com/qeepsake/rails-guid/commits?author=lukebrandonfarrell\" title=\"Code\"\u003e💻\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-enable --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqeepsake%2Frails-guid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqeepsake%2Frails-guid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqeepsake%2Frails-guid/lists"}