mockr.js
v1.0.2
Published
mockr.js is a lightweight npm package that simplifies the generation of realistic mock data for various use cases in development and testing.
Downloads
10
Readme
mockr.js
mockr.js is a powerful and flexible library designed to simplify the process of generating mock data for testing and development purposes. It supports a wide range of data types, including names, addresses, emails, and much more, making it an ideal choice for developers looking to create realistic and varied datasets.
Features
- Wide Range of Data Types: Generate mock data for names, emails, addresses, credit card numbers, and many other types.
- Customizable: Easily tailor the generated data to fit your specific needs.
- Easy to Use: Simple API and clear documentation to get you started quickly.
- Open Source: Freely available for personal and commercial use under the MIT license.
Getting Started
Prerequisites
- Node.js (version 20.x or higher recommended)
Installation
To install mockr.js, run the following command in your project directory:
npm install mockr.js
# or
yarn add mockr.js
# or
bun add mockr.js
Types
| Name | Function | Possible Variants | Responses |
|---------------|-------------------------------------------------|-----------------------------------------------------|---------------------------------------|
| Address | generateAddress()
| 127 | Street, City, ZIP, State, Country |
| Browser Agent | generateBrowserAgent()
| 3.000 | Browser Agent |
| Company | generateCompany()
| 3.317.520 | Name, Job Title, Department, Location |
| Contact | generateContact()
| 8.498.675 | Email, Phone, Mobile, Fax |
| Credit Card | generateCreditCard()
| 4.800.000.000.000.000.000.000.000 | Holder, Number, Type, Expire, CVV |
| Date | generateDate()
| ∞ | Date |
| Date and Time | generateDateAndTime()
| ∞ | Date, Time |
| Domain | generateDomain()
| 50 | Domain |
| Geolocation | generateGeolocation()
| 9.007.199.254.740.992 | Geolocation |
| IBAN | generateIBAN()
| 3.656.158.440.062.976 | IBAN |
| IPv4 | generateIPv4()
| 4,294,967,296 | IPv4 |
| IPv6 | generateIPv6()
| 340.282.366.920.938.463.463.374.607.431.768.211.456 | IPv6 |
| MAC | generateMAC()
| 281.474.976.710.656 | MAC |
| Name | generateName()
| 9200 | First Name, Last Name |
| SWIFT | generateSWIFT()
| 20 | SWIFT |
| Time | generateTime()
| 86,400,000 | Hour, Minute, Second, Millisecond |
| Timezone | generateTimezone()
| 139 | Timezone |
| URL | generateURL()
| 78.364.164.096 | URL |
Contributing
We welcome contributions to mockr.js! If you're interested in helping improve the project.
Support
If you encounter any issues or have questions, please file a bug report or feature request through our GitHub Issues.
License
mockr.js is open-source software licensed under the MIT license.