{"id":15059485,"url":"https://github.com/sqids/sqids-elm","last_synced_at":"2025-04-10T05:30:38.168Z","repository":{"id":176746981,"uuid":"658043801","full_name":"sqids/sqids-elm","owner":"sqids","description":"Official Elm port of Sqids. Generate short unique IDs from numbers.","archived":false,"fork":false,"pushed_at":"2025-01-28T21:28:45.000Z","size":107,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-02T18:16:25.245Z","etag":null,"topics":["elm","elm-lang","hashids","id","id-generator","short-id","short-url","sqids","uid","unique-id","unique-id-generator"],"latest_commit_sha":null,"homepage":"https://sqids.org/elm","language":"Elm","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/sqids.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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-06-24T15:35:15.000Z","updated_at":"2025-03-11T03:41:26.000Z","dependencies_parsed_at":null,"dependency_job_id":"081772b6-e41d-4c93-8bbb-69480a4af82b","html_url":"https://github.com/sqids/sqids-elm","commit_stats":null,"previous_names":["sqids/sqids-elm"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqids%2Fsqids-elm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqids%2Fsqids-elm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqids%2Fsqids-elm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqids%2Fsqids-elm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sqids","download_url":"https://codeload.github.com/sqids/sqids-elm/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248162922,"owners_count":21057836,"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":["elm","elm-lang","hashids","id","id-generator","short-id","short-url","sqids","uid","unique-id","unique-id-generator"],"created_at":"2024-09-24T22:44:23.436Z","updated_at":"2025-04-10T05:30:38.119Z","avatar_url":"https://github.com/sqids.png","language":"Elm","funding_links":[],"categories":[],"sub_categories":[],"readme":"# [Sqids Elm](https://sqids.org/elm)\n\n[Sqids](https://sqids.org/elm) (_pronounced \"squids\"_) is a small library that lets you **generate unique IDs from numbers**. It is good for link shortening, fast \u0026 URL-safe ID generation and decoding back into numbers for quicker database lookups.\n\nFeatures:\n\n- **Encode multiple numbers** - generate short IDs from one or several non-negative numbers\n- **Quick decoding** - easily decode IDs back into numbers\n- **Unique IDs** - generate unique IDs by shuffling the alphabet once\n- **ID padding** - provide minimum length to make IDs more uniform\n- **URL safe** - auto-generated IDs do not contain common profanity\n- **Randomized output** - Sequential input provides nonconsecutive IDs\n- **Many implementations** - Support for [40+ programming languages](https://sqids.org/)\n\n## 🧰 Use-cases\n\nGood for:\n\n- Generating IDs for public URLs (eg: link shortening)\n- Generating IDs for internal systems (eg: event tracking)\n- Decoding for quicker database lookups (eg: by primary keys)\n\nNot good for:\n\n- Sensitive data (this is not an encryption library)\n- User IDs (can be decoded revealing user count)\n\n## 🚀 Getting started\n\nInstall with\n\n```sh\nelm install sqids/sqids-elm\n```\n\n## 👩‍💻 Examples\n\nSimple encode \u0026 decode:\n\n```elm\nimport Sqids\n\nSqids.encode [ 1, 2, 3 ]\n--\u003e (Ok \"86Rf07\")\n\nSqids.decode \"86Rf07\"\n--\u003e (Ok [ 1, 2, 3 ])\n```\n\nIf IDs are too short, you can pad them to a certain length:\n\n```elm\nimport Sqids\nimport Sqids.Context\n\ncontext : Sqids.Context.Context\ncontext =\n    case\n        Sqids.Context.from\n            { alphabet = Sqids.Context.defaultAlphabet\n            , minLength = 10\n            , blockList = Sqids.Context.defaultBlockList\n            }\n    of\n        Ok ok -\u003e\n            ok\n\n        Err err -\u003e\n            Debug.todo \u003c| Debug.toString err\n\nSqids.encodeWith context [ 1, 2, 3 ]\n--\u003e (Ok \"86Rf07xd4z\")\n\nSqids.decodeWith context \"86Rf07xd4z\"\n--\u003e (Ok [ 1, 2, 3 ])\n```\n\nCreate unique IDs by shuffling the alphabet:\n\n\n```elm\nimport Sqids\nimport Sqids.Context\n\ncontext : Sqids.Context.Context\ncontext =\n    case\n        Sqids.Context.new\n            |\u003e Sqids.Context.withAlphabet \"k3G7QAe51FCsPW92uEOyq4Bg6Sp8YzVTmnU0liwDdHXLajZrfxNhobJIRcMvKt\"\n            |\u003e Sqids.Context.build\n    of\n        Ok ok -\u003e\n            ok\n\n        Err err -\u003e\n            Debug.todo \u003c| Debug.toString err\n\nSqids.encodeWith context [ 1, 2, 3 ]\n--\u003e (Ok \"XRKUdQ\")\n\nSqids.decodeWith context \"XRKUdQ\"\n--\u003e (Ok [ 1, 2, 3 ])\n```\n\n## Development\n\nYou need the Elm compiler and an elm test runner (e.g. [elm-test](https://www.npmjs.com/package/elm-test) or [elm-test-rs](https://github.com/mpizenberg/elm-test-rs)).\n\nAn easy way to get started is with [node.js](https://nodejs.org) and [elm-tooling](https://elm-tooling.github.io/elm-tooling-cli/).\n\n```sh\n# Install dependencies\nnpm install\nnpx elm-tooling install\n# Ensure that no unused code exists or that the documentation comments are correct\nnpx elm-review --fix\n# Run tests in watch mode\nnpx elm-test-rs --watch\n```\n\nNote: Running [elm-review](https://package.elm-lang.org/packages/jfmengels/elm-review/latest/) also creates the test file `tests/DocumentationCodeSnippetTest.elm` to check the code snippets in the README.md file and also the documentation comments in source code.\n\n### CI\n\n@todo add the [elm-tooling-action GitHub action](https://github.com/mpizenberg/elm-tooling-action).\n\n## License\n\n[MIT](https://github.com/sqids/sqids-elm/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqids%2Fsqids-elm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsqids%2Fsqids-elm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqids%2Fsqids-elm/lists"}