{"id":15690454,"url":"https://github.com/timmikeladze/space-slug","last_synced_at":"2025-09-11T13:05:45.397Z","repository":{"id":187419187,"uuid":"676904700","full_name":"TimMikeladze/space-slug","owner":"TimMikeladze","description":"🐌  Generate unique slugs like `wonderful-jabba` or `hyperspace-4812` using a customizable api with zero dependencies.","archived":false,"fork":false,"pushed_at":"2025-08-31T14:00:16.000Z","size":511,"stargazers_count":9,"open_issues_count":12,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-08-31T15:36:12.409Z","etag":null,"topics":["random","random-slug","random-word","random-word-generator","random-words","slug","slug-generator","slugifier","slugify","slugs","to-slug","unique-slug","unique-slug-generator","unique-words","username-generator"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/TimMikeladze.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","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,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"ko_fi":"linesofcodedev","custom":["https://www.paypal.me/TimMikeladze"]}},"created_at":"2023-08-10T09:25:50.000Z","updated_at":"2024-10-01T11:13:03.000Z","dependencies_parsed_at":"2023-08-10T10:01:52.095Z","dependency_job_id":"cc9f0ef7-70c8-4510-8502-3d278ea22ed6","html_url":"https://github.com/TimMikeladze/space-slug","commit_stats":{"total_commits":42,"total_committers":3,"mean_commits":14.0,"dds":0.1428571428571429,"last_synced_commit":"5ced60a126fb9748c8d259055de0aea557f61ffa"},"previous_names":["timmikeladze/space-slug"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/TimMikeladze/space-slug","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimMikeladze%2Fspace-slug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimMikeladze%2Fspace-slug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimMikeladze%2Fspace-slug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimMikeladze%2Fspace-slug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TimMikeladze","download_url":"https://codeload.github.com/TimMikeladze/space-slug/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TimMikeladze%2Fspace-slug/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274640911,"owners_count":25322843,"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","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["random","random-slug","random-word","random-word-generator","random-words","slug","slug-generator","slugifier","slugify","slugs","to-slug","unique-slug","unique-slug-generator","unique-words","username-generator"],"created_at":"2024-10-03T18:09:49.407Z","updated_at":"2025-09-11T13:05:45.376Z","avatar_url":"https://github.com/TimMikeladze.png","language":"TypeScript","funding_links":["https://ko-fi.com/linesofcodedev","https://www.paypal.me/TimMikeladze"],"categories":[],"sub_categories":[],"readme":"# 🐌 space-slug\n\nGet a unique string that looks like this `wonderful-jabba` or this `hyperspace-4812`.\n\nGenerate unique slugs, usernames, numbers, custom words, and more using an intuitive api with zero dependencies.\n\n```tsx\nconst { spaceSlug } from 'space-slug';\n\nconst slug = spaceSlug();\n// Returns: joyful-illusion-30\n```\n\n## 📡 Install\n\n```console\nnpm install space-slug\n\nyarn add space-slug\n\npnpm add space-slug\n```\n\n\u003e 👋 Hello there! Follow me [@linesofcode](https://twitter.com/linesofcode) or visit [linesofcode.dev](https://linesofcode.dev) for more cool projects like this one.\n\n## 🚀 Getting Started\n\n```ts\nconst { spaceSlug, adjective, color, digits, noun } from 'space-slug';\n\nconst slug = spaceSlug([color(), adjective(), noun(1), digits(3)], {\n  separator: '_'\n});\n// Returns: blue_celestial_labyrinth_718\n```\n\n## 📚 Custom dictionaries and locales\n\n```ts\nconst { spaceSlug, word, SpaceSlugDictionary } from 'space-slug';\n\nconst dictionary: SpaceSlugDictionary = {\n  en: {\n    starwars: ['jabba', 'ezra'],\n  },\n};\n\nconst slug = spaceSlug([word('starwars')(2), digits(2)], {\n  dictionary,\n  locale: 'en',\n});\n/// Returns: jabba-ezra-39\n```\n\n## 🗃️ Tracking used slugs\n\n```ts\nconst { uniqueSpaceSlug, color, digits } from 'space-slug';\n\nconst slug = await uniqueSpaceSlug([\n  color(1),\n  digits(4),\n], {\n  usedSlugs: ['orange-3918']\n});\n// Returns: a slug that is not orange-3918\n```\n\n## ✅ Verifying that a slug is a unique\n\n```ts\nconst { uniqueSpaceSlug } from 'space-slug';\n\nawait uniqueSpaceSlug([], {\n  maxAttempts: 10, // default is 10 attempts before throwing an error\n  isUnique: async (slug) =\u003e {\n    // check database to see if slug is unique\n    return true;\n  }\n});\n// Returns: a slug that you have verified is unique\n```\n\n## 🦄 Making a slug unique\n\n```ts\nawait uniqueSpaceSlug(['jabba'], {\n  isUnique: async (slug) =\u003e {\n    // a db lookup to see if slug is unique\n    return false;\n  },\n  makeUnique: async (slug) =\u003e {\n    // somehow make the slug unique\n    return slug + '-hutt';\n  }\n});\n```\n\n## ✨ Transforming a slug\n\n```tsx\nconst { spaceSlug } from 'space-slug';\n\nawait spaceSlug([], {\n  transform: (x) =\u003e x.toUpperCase()\n});\n// Returns: QUAINT-HORIZON-1293\n```\n\n## ✏️ Using hard-coded values\n\n```tsx\nconst { spaceSlug, color, digits } from 'space-slug';\n\nspaceSlug([\n  'jabba',\n  digits(),\n];\n// Returns: jabba-1293\n\nspaceSlug([\n  color(),\n  ['jabba', 'hutt'],\n  digits(),\n];\n// Returns: red-jabba-hutt-3979\n```\n\n\u003c!-- TSDOC_START --\u003e\n\n## :toolbox: Functions\n\n- [word](#gear-word)\n- [digits](#gear-digits)\n- [cleanString](#gear-cleanstring)\n- [uniqueSpaceSlug](#gear-uniquespaceslug)\n- [spaceSlug](#gear-spaceslug)\n\n### :gear: word\n\n| Function | Type |\n| ---------- | ---------- |\n| `word` | `(type: string) =\u003e (count?: number or undefined, _words?: string[] or undefined) =\u003e (options: SpaceSlugOptions) =\u003e Set\u003cstring\u003e` |\n\n### :gear: digits\n\n| Function | Type |\n| ---------- | ---------- |\n| `digits` | `(count?: number or undefined, noConsecutive?: boolean or undefined) =\u003e (options: SpaceSlugOptions) =\u003e string` |\n\n### :gear: cleanString\n\n| Function | Type |\n| ---------- | ---------- |\n| `cleanString` | `(inputString: string, separator: string) =\u003e string` |\n\n### :gear: uniqueSpaceSlug\n\n| Function | Type |\n| ---------- | ---------- |\n| `uniqueSpaceSlug` | `(spaceSlugFn: SpaceSlugInput[], options?: SpaceSlugOptions and UniqueSpaceSlugOptions) =\u003e Promise\u003cstring\u003e` |\n\n### :gear: spaceSlug\n\n| Function | Type |\n| ---------- | ---------- |\n| `spaceSlug` | `(spaceSlugInputs?: SpaceSlugInput[] or undefined, options?: SpaceSlugOptions) =\u003e string` |\n\n\n## :wrench: Constants\n\n- [spaceSlugDefaultDictionary](#gear-spaceslugdefaultdictionary)\n- [spaceSlugDefaultOptions](#gear-spaceslugdefaultoptions)\n- [noun](#gear-noun)\n- [adjective](#gear-adjective)\n- [color](#gear-color)\n- [season](#gear-season)\n- [emoji](#gear-emoji)\n- [verb](#gear-verb)\n- [animal](#gear-animal)\n- [cosmos](#gear-cosmos)\n\n### :gear: spaceSlugDefaultDictionary\n\n| Constant | Type |\n| ---------- | ---------- |\n| `spaceSlugDefaultDictionary` | `SpaceSlugDictionary` |\n\n### :gear: spaceSlugDefaultOptions\n\n| Constant | Type |\n| ---------- | ---------- |\n| `spaceSlugDefaultOptions` | `Partial\u003cSpaceSlugOptions\u003e` |\n\n### :gear: noun\n\n| Constant | Type |\n| ---------- | ---------- |\n| `noun` | `(count?: number or undefined, _words?: string[] or undefined) =\u003e (options: SpaceSlugOptions) =\u003e Set\u003cstring\u003e` |\n\n### :gear: adjective\n\n| Constant | Type |\n| ---------- | ---------- |\n| `adjective` | `(count?: number or undefined, _words?: string[] or undefined) =\u003e (options: SpaceSlugOptions) =\u003e Set\u003cstring\u003e` |\n\n### :gear: color\n\n| Constant | Type |\n| ---------- | ---------- |\n| `color` | `(count?: number or undefined, _words?: string[] or undefined) =\u003e (options: SpaceSlugOptions) =\u003e Set\u003cstring\u003e` |\n\n### :gear: season\n\n| Constant | Type |\n| ---------- | ---------- |\n| `season` | `(count?: number or undefined, _words?: string[] or undefined) =\u003e (options: SpaceSlugOptions) =\u003e Set\u003cstring\u003e` |\n\n### :gear: emoji\n\n| Constant | Type |\n| ---------- | ---------- |\n| `emoji` | `(count?: number or undefined, _words?: string[] or undefined) =\u003e (options: SpaceSlugOptions) =\u003e Set\u003cstring\u003e` |\n\n### :gear: verb\n\n| Constant | Type |\n| ---------- | ---------- |\n| `verb` | `(count?: number or undefined, _words?: string[] or undefined) =\u003e (options: SpaceSlugOptions) =\u003e Set\u003cstring\u003e` |\n\n### :gear: animal\n\n| Constant | Type |\n| ---------- | ---------- |\n| `animal` | `(count?: number or undefined, _words?: string[] or undefined) =\u003e (options: SpaceSlugOptions) =\u003e Set\u003cstring\u003e` |\n\n### :gear: cosmos\n\n| Constant | Type |\n| ---------- | ---------- |\n| `cosmos` | `(count?: number or undefined, _words?: string[] or undefined) =\u003e (options: SpaceSlugOptions) =\u003e Set\u003cstring\u003e` |\n\n\n\n\u003c!-- TSDOC_END --\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimmikeladze%2Fspace-slug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimmikeladze%2Fspace-slug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimmikeladze%2Fspace-slug/lists"}