{"id":28236939,"url":"https://github.com/bytebodger/create-random-id","last_synced_at":"2025-06-10T15:31:02.537Z","repository":{"id":52247134,"uuid":"342884753","full_name":"bytebodger/create-random-id","owner":"bytebodger","description":"A simple utility to generate random IDs","archived":false,"fork":false,"pushed_at":"2021-05-03T17:42:46.000Z","size":175,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-19T00:17:26.309Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bytebodger.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":"2021-02-27T15:07:51.000Z","updated_at":"2021-05-03T17:42:49.000Z","dependencies_parsed_at":"2022-08-30T23:51:44.079Z","dependency_job_id":null,"html_url":"https://github.com/bytebodger/create-random-id","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebodger%2Fcreate-random-id","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebodger%2Fcreate-random-id/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebodger%2Fcreate-random-id/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebodger%2Fcreate-random-id/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bytebodger","download_url":"https://codeload.github.com/bytebodger/create-random-id/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bytebodger%2Fcreate-random-id/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259101177,"owners_count":22805220,"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-05-19T00:17:06.066Z","updated_at":"2025-06-10T15:31:02.517Z","avatar_url":"https://github.com/bytebodger.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# create-random-id\n\n`create-random-id` is a tiny utility function to generate random IDs (strings). It uses `Math.random()`, and as such, it provides no level of cryptographic security. But it should be perfectly fine whenever you simply need to generate a pseudo-random string.\n\n## Usage\n\nAfter installation, import the package:\n\n```javascript\nimport { createRandomId } from '@toolz/create-random-id';\n```\n\n### createRandomId()\n\n`createRandomId()` generates a random string. The first character in the string will be a letter (unless `useUppercaseLetters` and `useLowercaseLetters` are both set to `FALSE`). All subsequent characters will be uppercase letters (unless `useUppercaseLetters` is set to `FALSE`), lowercase letters (unless `useLowercaseLetters` is set to `FALSE`), and numbers (unless `useNumbers` is set to `FALSE`).\n\nIf `useUppercaseLetters`, `useLowercaseLetters` and `useNumbers` are _all_ set to `FALSE`, the function will ignore the settings and generate a string containing uppercase letters, lowercase letters, and numbers.\n\n```javascript\nconst API = {\n   arguments: {\n      length: {\n         optional,\n         format: 'positive integer',\n         defaultValue: 32,\n      },\n      useUppercaseLetters: {\n         optional,\n         format: Boolean,\n         defaultValue: true,\n      },\n      useLowercaseLetters: {\n         optional,\n         format: Boolean,\n         defaultValue: true,\n      },\n      useNumbers: {\n         optional,\n         format: Boolean,\n         defaultValue: true,\n      },\n   },\n   returns: string,\n}\n```\n\n**Examples:**\n\n```javascript\ncreateRandomId(); // MJYeNOFFhx52AmBuzo5YC2yN2TPN3N1O\ncreateRandomId(100); // wSLOH1nZ6WdCy7mHLwBOPoK08250fHN8xe8ipNkT07MjJFU5u55uPrIYs80OQZMmoUakM8Mfn1l8ue2AikKoRciTZFS2O74i1lQM\ncreateRandomId(32, false); // udu3dhp2ht8dxtf38o5l1o8wspiymrgk\ncreateRandomId(32, false, false); // 58388737442364071155558324301586\ncreateRandomId(32, false, false, false); // ebWpxLSF7aQkGHIItKPqNNmOGZhFeNot\ncreateRandomId(32, true, false); // XCZMJCYINK4UYIUABPIXX2I1DBX44R1C\ncreateRandomId(32, true, true, false); // pndomtXQXjPlHbfixGKEchlgiqGWAGuQ\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytebodger%2Fcreate-random-id","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbytebodger%2Fcreate-random-id","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbytebodger%2Fcreate-random-id/lists"}