{"id":42570473,"url":"https://github.com/wow-apps/youtube-id-ts","last_synced_at":"2026-04-02T18:51:41.109Z","repository":{"id":333784647,"uuid":"1128847954","full_name":"wow-apps/youtube-id-ts","owner":"wow-apps","description":"Generate YouTube-style short IDs from numbers. Lightweight, fast, and reversible base62 encoder with optional obfuscation.","archived":false,"fork":false,"pushed_at":"2026-03-30T05:05:02.000Z","size":157,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-03-30T06:58:43.028Z","etag":null,"topics":["alphanumeric","base62","encoder","hashids","id-generator","obfuscation","short-id","unique-id","url-shortener","youtube-id"],"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/wow-apps.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","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}},"created_at":"2026-01-06T08:34:24.000Z","updated_at":"2026-03-30T05:05:06.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/wow-apps/youtube-id-ts","commit_stats":null,"previous_names":["wow-apps/youtube-id-ts"],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/wow-apps/youtube-id-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wow-apps%2Fyoutube-id-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wow-apps%2Fyoutube-id-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wow-apps%2Fyoutube-id-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wow-apps%2Fyoutube-id-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wow-apps","download_url":"https://codeload.github.com/wow-apps/youtube-id-ts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wow-apps%2Fyoutube-id-ts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31313478,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["alphanumeric","base62","encoder","hashids","id-generator","obfuscation","short-id","unique-id","url-shortener","youtube-id"],"created_at":"2026-01-28T21:07:04.920Z","updated_at":"2026-04-02T18:51:41.088Z","avatar_url":"https://github.com/wow-apps.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# YouTubeID for TypeScript\n\nGenerate YouTube-style short IDs from numbers. Lightweight, fast, and reversible base62 encoder with optional obfuscation.\n\n[![npm version](https://badge.fury.io/js/youtube-like-id.svg)](https://badge.fury.io/js/youtube-like-id)\n[![Node.js 18+](https://img.shields.io/badge/node-18+-blue.svg)](https://nodejs.org/)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)\n\n## Other programming languages\n\n- **PHP**: [kvz/youtube-id](https://github.com/kvz/youtube-id)\n- **Python**: [wow-apps/youtube-id-py](https://github.com/wow-apps/youtube-id-py/)\n- **TypeScript**: [wow-apps/youtube-id-ts](https://github.com/wow-apps/youtube-id-ts/)\n- **Go**: [wow-apps/youtube-id-go](https://github.com/wow-apps/youtube-id-go/)\n\n## Features\n\n- **Lightweight** - Zero dependencies, pure TypeScript\n- **Fast** - Simple base62 encoding/decoding\n- **Reversible** - Encode and decode without data loss\n- **Obfuscation** - Optional secure key to shuffle the dictionary\n- **Type-safe** - Full TypeScript support with strict types\n- **Universal** - Works in Node.js and browsers (ESM + CJS)\n\n## Installation\n\n```bash\nnpm install youtube-like-id\n```\n\nOr with yarn/pnpm:\n\n```bash\nyarn add youtube-like-id\npnpm add youtube-like-id\n```\n\n## Quick Start\n\n```typescript\nimport { toAlphanumeric, toNumeric } from 'youtube-like-id';\n\n// Encode a number to a short string\ntoAlphanumeric(12345);  // -\u003e 'dnh'\n\n// Decode back to number\ntoNumeric('dnh');  // -\u003e 12345\n```\n\n## Usage\n\n### Basic Encoding/Decoding\n\n```typescript\nimport { toAlphanumeric, toNumeric } from 'youtube-like-id';\n\n// Number to alphanumeric\ntoAlphanumeric(0);        // -\u003e 'a'\ntoAlphanumeric(61);       // -\u003e 'Z'\ntoAlphanumeric(62);       // -\u003e 'ba'\ntoAlphanumeric(12345);    // -\u003e 'dnh'\ntoAlphanumeric(999999);   // -\u003e 'eGGf'\n\n// Alphanumeric to number\ntoNumeric('dnh');         // -\u003e 12345\n```\n\n### With Secure Key (Obfuscation)\n\nUse a secure key to shuffle the dictionary, making IDs harder to predict:\n\n```typescript\nimport { toAlphanumeric, toNumeric } from 'youtube-like-id';\n\n// Without key\ntoAlphanumeric(12345);                          // -\u003e 'dnh'\n\n// With secure key (different output)\ntoAlphanumeric(12345, { secureKey: 'secret' }); // -\u003e 'UDJ'\n\n// Decode with the same key\ntoNumeric('UDJ', { secureKey: 'secret' });      // -\u003e 12345\n```\n\n### Case Transformation\n\n```typescript\nimport { toAlphanumeric, Transform } from 'youtube-like-id';\n\ntoAlphanumeric(12345, { transform: Transform.UPPER });  // -\u003e 'DNH'\ntoAlphanumeric(12345, { transform: Transform.LOWER });  // -\u003e 'dnh'\n```\n\n### Encoder Factory\n\nFor repeated operations with the same settings, use the `Encoder` class:\n\n```typescript\nimport { create, Transform } from 'youtube-like-id';\n\n// Create encoder with preset options\nconst enc = create({ secureKey: 'my-secret', transform: Transform.UPPER });\n\n// Encode\nenc.encode(12345);      // -\u003e 'HQJ' (transformed for display)\nenc.encodeRaw(12345);   // -\u003e 'hqj' (raw for storage/decoding)\n\n// Decode\nenc.decode('hqj');      // -\u003e 12345\n```\n\n## API Reference\n\n### Functions\n\n#### `toAlphanumeric(number, options?)`\n\nConvert a number to a short alphanumeric string.\n\n| Parameter           | Type        | Default  | Description               |\n|---------------------|-------------|----------|---------------------------|\n| `number`            | `number`    | required | The number to convert     |\n| `options.padUp`     | `number`    | `0`      | Padding value             |\n| `options.secureKey` | `string`    | -        | Key to shuffle dictionary |\n| `options.transform` | `Transform` | `NONE`   | Case transformation       |\n\n#### `toNumeric(alphanumeric, options?)`\n\nConvert an alphanumeric string back to a number.\n\n| Parameter           | Type     | Default  | Description                         |\n|---------------------|----------|----------|-------------------------------------|\n| `alphanumeric`      | `string` | required | The string to convert               |\n| `options.padUp`     | `number` | `0`      | Padding value (must match encoding) |\n| `options.secureKey` | `string` | -        | Key (must match encoding)           |\n\n#### `create(options?)`\n\nCreate a reusable `Encoder` instance with preset options.\n\n### Classes\n\n#### `Encoder`\n\nReusable encoder with preset options.\n\n- `encode(number)` - Convert number to alphanumeric (with transform)\n- `encodeRaw(number)` - Convert number to alphanumeric (without transform)\n- `decode(alphanumeric)` - Convert alphanumeric to number\n\n#### `Transform`\n\nEnum for case transformation:\n\n- `Transform.NONE` - No transformation\n- `Transform.UPPER` - Uppercase output\n- `Transform.LOWER` - Lowercase output\n\n### Types\n\n```typescript\ninterface ConvertOptions {\n  padUp?: number;\n  secureKey?: string;\n  transform?: Transform;\n}\n```\n\n## Use Cases\n\n- **URL shorteners** - Convert database IDs to short URLs\n- **Public IDs** - Hide sequential database IDs from users\n- **Share codes** - Generate readable codes for sharing\n- **Invite links** - Create short invitation tokens\n\n## Performance\n\nThe library uses base62 encoding (a-z, 0-9, A-Z) which provides:\n\n| Number Range         | Output Length |\n|----------------------|---------------|\n| 0 - 61               | 1 character   |\n| 62 - 3,843           | 2 characters  |\n| 3,844 - 238,327      | 3 characters  |\n| 238,328 - 14,776,335 | 4 characters  |\n\n## Contributing\n\nContributions are welcome! Please read our [Contributing Guidelines](CONTRIBUTING.md) and [Code of Conduct](CODE_OF_CONDUCT.md).\n\n```bash\n# Clone and setup\ngit clone https://github.com/wow-apps/youtube-id-ts.git\ncd youtube-id-ts\nnpm install\n\n# Run tests\nnpm test\n\n# Build\nnpm run build\n```\n\n## Credits\n\nA TypeScript port of the YouTube-style ID generator originally created by [Kevin van Zonneveld](https://github.com/kvz) and contributors.\n\n## License\n\n[MIT](LICENSE) © Oleksii Samara, Kevin van Zonneveld\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwow-apps%2Fyoutube-id-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwow-apps%2Fyoutube-id-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwow-apps%2Fyoutube-id-ts/lists"}