1.0.0 • Published 7 months ago

mocklingua v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

Mocklingua

A powerful CLI tool for generating random fake data in multiple languages. Perfect for testing, development, and database seeding purposes.

Features

  • 🌍 Supports multiple languages: English, Turkish, German, and Spanish
  • 🎲 Generates realistic user profiles and addresses
  • 🔄 Mixed language mode for diverse data sets
  • 💾 JSON output format
  • ⚡ Simple and fast CLI interface
  • 🛠️ Can be used programmatically in your projects

Installation

npm install -g mocklingua

CLI Usage

Basic syntax:

mocklingua <count> [locale]

Examples

Generate 50 records with mixed languages:

mocklingua 50

Generate records in specific languages:

mocklingua 50 en    # English
mocklingua 50 tr    # Turkish
mocklingua 50 de    # German
mocklingua 50 es    # Spanish

Programmatic Usage

const { generateUser } = require('mocklingua/src/user');
const { generateAddress } = require('mocklingua/src/address');

// Generate a user profile
const user = generateUser('en');
console.log(user);
// {
//   firstName: "John",
//   lastName: "Smith",
//   fullName: "John Smith"
// }

// Generate an address
const address = generateAddress('en');
console.log(address);
// {
//   city: "London",
//   country: "UK",
//   fullAddress: "London, UK"
// }

Output Format

The tool generates a fakedata.json file with the following structure:

[
  {
    "firstName": "John",
    "lastName": "Smith",
    "fullName": "John Smith",
    "city": "London",
    "country": "UK",
    "fullAddress": "London, UK"
  },
  // ... more entries
]

Supported Languages

LanguageCode
Englishen
Turkishtr
Germande
Spanishes

Development

  1. Clone the repository:
git clone https://github.com/salihkaankoc/mocklingua.git
  1. Install dependencies:
cd mocklingua
npm install
  1. Run tests:
npm test

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.


Happy coding! 🚀