{"id":32460218,"url":"https://github.com/027xiguapi/randbox","last_synced_at":"2025-10-26T11:23:28.675Z","repository":{"id":318770962,"uuid":"1075242759","full_name":"027xiguapi/randbox","owner":"027xiguapi","description":"RandBox - Random generator helper for JavaScript","archived":false,"fork":false,"pushed_at":"2025-10-22T03:21:43.000Z","size":5308,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-22T05:28:40.301Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://randbox.top/en","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/027xiguapi.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,"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":"2025-10-13T08:31:27.000Z","updated_at":"2025-10-22T03:21:47.000Z","dependencies_parsed_at":"2025-10-15T13:40:39.159Z","dependency_job_id":"e0f2f713-58df-4d7b-bfc2-09c41fdbe6ab","html_url":"https://github.com/027xiguapi/randbox","commit_stats":null,"previous_names":["027xiguapi/randbox"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/027xiguapi/randbox","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/027xiguapi%2Frandbox","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/027xiguapi%2Frandbox/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/027xiguapi%2Frandbox/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/027xiguapi%2Frandbox/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/027xiguapi","download_url":"https://codeload.github.com/027xiguapi/randbox/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/027xiguapi%2Frandbox/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280865076,"owners_count":26404439,"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-10-24T02:00:06.418Z","response_time":73,"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":[],"created_at":"2025-10-26T11:23:27.843Z","updated_at":"2025-10-26T11:23:28.661Z","avatar_url":"https://github.com/027xiguapi.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RandBox\n\n[![npm version](https://badge.fury.io/js/randbox.svg)](https://badge.fury.io/js/randbox)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nRandBox is a powerful JavaScript random data generation library, providing a rich API for generating various types of random data with TypeScript support.\n\n**🏠 Homepage:** [https://randbox.top](https://randbox.top)\n**📦 Repository:** [https://github.com/027xiguapi/randbox](https://github.com/027xiguapi/randbox)\n\n## Features\n\n- 🎲 **Comprehensive Data Generation** - Generate random data across 10+ categories\n- 🌳 **Tree Shaking Support** - Import only what you need with ES6 modules\n- 📝 **TypeScript Support** - Full TypeScript definitions included\n- 🔧 **Flexible Usage** - Use as a complete library or import individual functions\n- 🎯 **Extensive API** - Over 100 methods for different data types\n- 🧪 **Well Tested** - Comprehensive test coverage\n\n## Installation\n\n```bash\nnpm install randbox\n```\n\n## Quick Start\n\n```javascript\nimport RandBox from 'randbox';\n\nconst randBox = new RandBox();\n\n// Generate basic data\nconsole.log(randBox.name());        // \"John Smith\"\nconsole.log(randBox.email());       // \"john@example.com\"\nconsole.log(randBox.integer(1, 10)); // 7\nconsole.log(randBox.bool());         // true\n```\n\n## Data Categories\n\nRandBox provides random data generation across multiple categories:\n\n### 📊 **Basics** - Core random generation\n- `bool()`, `character()`, `floating()`, `integer()`, `natural()`, `string()`, `buffer()`, `hex()`\n\n### 🔧 **Helpers** - Array and utility functions\n- `capitalize()`, `mixin()`, `unique()`, `n()`, `pad()`, `pick()`, `pickone()`, `pickset()`, `shuffle()`, `weighted()`\n\n### 📝 **Text** - Text generation\n- `paragraph()`, `sentence()`, `syllable()`, `word()`, `emoji()`\n\n### 👤 **Person** - People-related data\n- `age()`, `birthday()`, `first()`, `last()`, `name()`, `gender()`, `ssn()`, `animal()`\n\n### 📱 **Mobile** - Mobile device identifiers\n- `android_id()`, `apple_token()`, `wp8_anid2()`, `wp7_anid()`, `bb_pin()`\n\n### 🌐 **Web** - Web-related data\n- `avatar()`, `color()`, `domain()`, `email()`, `ip()`, `url()`, `hashtag()`\n\n### 📍 **Location** - Geographic data\n- `address()`, `city()`, `country()`, `coordinates()`, `latitude()`, `longitude()`, `phone()`\n\n### 💰 **Finance** - Financial data\n- `cc()`, `currency()`, `dollar()`, `euro()`, `iban()`, `luhn_check()`\n\n### 🎵 **Music** - Music-related data\n- `note()`, `chord()`, `tempo()`, `music_genre()`\n\n### 🎲 **Miscellaneous** - Various utilities\n- `coin()`, dice functions (`d4()`, `d6()`, etc.), `guid()`, `hash()`, date functions, `normal()`\n\n## Advanced Usage\n\n### Tree Shaking Support\n\nImport only the modules you need for optimal bundle size:\n\n```javascript\n// Import specific functions\nimport { name, email } from 'randbox/dist/person';\nimport { natural } from 'randbox/dist/basics';\n\nconsole.log(name());    // Direct function call\nconsole.log(natural()); // Generate natural number\n```\n\n### Custom Seeding\n\n```javascript\nimport RandBox from 'randbox';\n\nconst randBox = new RandBox('my-seed');\nconsole.log(randBox.integer(1, 10)); // Reproducible results\n```\n\n### Multiple Instance Usage\n\n```javascript\nimport RandBox from 'randbox';\n\nconst userGen = new RandBox();\nconst testGen = new RandBox('test-seed');\n\n// Different generators for different purposes\nconst user = {\n  name: userGen.name(),\n  email: userGen.email(),\n  age: userGen.age()\n};\n\nconst testData = {\n  id: testGen.guid(),\n  value: testGen.floating(0, 100)\n};\n```\n\n## Documentation\n\nFor comprehensive documentation and examples, visit: [https://randbox.top](https://randbox.top)\n\n## Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.\n\n## License\n\nMIT License - see the [LICENSE](LICENSE) file for details.\n\n## Author\n\n**027xiguapi** - [458813868@qq.com](mailto:458813868@qq.com)\n\n---\n\n## Technical Details\n\n### Module Structure\n\n### Core Module (`core.js`)\nThe main RandBox constructor with constants, utility functions, and core dependencies.\n\n**Exports:**\n- `RandBox` - Main constructor\n- Constants: `MAX_INT`, `MIN_INT`, `NUMBERS`, `CHARS_LOWER`, `CHARS_UPPER`, `HEX_POOL`\n- Utilities: `initOptions`, `testRange`, `range`, `base64`, `UnsupportedError`\n\n### Feature Modules\n\nEach module contains related functionality and can be imported individually:\n\n1. **Basics (`basics.js`)** - Core random generation\n   - `bool`, `character`, `floating`, `integer`, `natural`, `string`, `buffer`, `hex`\n\n2. **Helpers (`helpers.js`)** - Array and utility functions\n   - `capitalize`, `mixin`, `unique`, `n`, `pad`, `pick`, `pickone`, `pickset`, `shuffle`, `weighted`\n\n3. **Text (`text.js`)** - Text generation\n   - `paragraph`, `sentence`, `syllable`, `word`, `emoji`\n\n4. **Person (`person.js`)** - People-related data\n   - `age`, `birthday`, `first`, `last`, `name`, `gender`, `ssn`, `animal`, etc.\n\n5. **Mobile (`mobile.js`)** - Mobile device identifiers\n   - `android_id`, `apple_token`, `wp8_anid2`, `wp7_anid`, `bb_pin`\n\n6. **Web (`web.js`)** - Web-related data\n   - `avatar`, `color`, `domain`, `email`, `ip`, `url`, `hashtag`, etc.\n\n7. **Location (`location.js`)** - Geographic data\n   - `address`, `city`, `country`, `coordinates`, `latitude`, `longitude`, `phone`, etc.\n\n8. **Finance (`finance.js`)** - Financial data\n   - `cc`, `currency`, `dollar`, `euro`, `iban`, `luhn_check`, etc.\n\n9. **Music (`music.js`)** - Music-related data\n   - `note`, `chord`, `tempo`, `music_genre`\n\n10. **Miscellaneous (`miscellaneous.js`)** - Various utilities\n    - `coin`, dice functions (`d4`, `d6`, etc.), `guid`, `hash`, date functions, `normal`\n\n### Usage Examples\n\n#### Import Everything (Equivalent to Original)\n```javascript\nimport RandBox from 'randbox';\nconst randBox = new RandBox();\nconsole.log(randBox.name()); // Works exactly like the original\n```\n\n#### Import Specific Modules (Tree Shaking)\n```javascript\nimport { RandBox, basicsFunctions } from 'randbox/dist/core';\nimport { name, email } from 'randbox/dist/person';\n\n// Use individual functions\nconsole.log(name()); // Direct function call\n\n// Or extend a RandBox instance with specific modules\nconst randBox = new RandBox();\nObject.assign(randBox, { name, email });\nconsole.log(randBox.name());\n```\n\n### Benefits\n\n1. **Tree Shaking**: Bundle only the functions you need\n2. **Maintainability**: Related functions are grouped together\n3. **Modularity**: Easy to add new modules or modify existing ones\n4. **ES6 Compatibility**: Modern JavaScript module system\n5. **Backwards Compatibility**: Main export provides the same API as the original\n6. **TypeScript Support**: Full type definitions included\n\nEach module imports only what it needs from `core.js`, minimizing dependencies and enabling better optimization.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F027xiguapi%2Frandbox","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F027xiguapi%2Frandbox","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F027xiguapi%2Frandbox/lists"}