npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

easy-mock-data

v0.1.1

Published

A handy tool for generating fake data.

Downloads

12

Readme

Easy-Mock-Data: Mock Data Generator

A convenient way to generate mock data for testing and development. You can use the library to create mock strings, numbers, texts, dates, names, products, and users with minimal effort.

Full TypeScript Support

Getting Started

Installation

Install the easy-mock-data library using npm:

npm install --save-dev easy-mock-data

Import

Import mockData into your project:

import { mockData } from 'easy-mock-data'

Usage Examples

const mockData = require('mock-data');

// Generate a fake string of length 10
const randomString = mockData.string(10); // OHKGxFarhs

// Generate a fake text with 5 words, capitalizing the first letter of each word
const randomText = mockData.text(5, {
    capitalizeFirstLetter: true
}); // Wildberry mango mango lemon wildberry

// Generate a fake number with 3 digits
const randomNumber = mockData.number(3); // 172

// Generate a fake array of numbers
const numberArray = mockData.numberArray(5) //  [32495, 8069, 74844, 9617, 81703]

// Generate a fake array of strings
const stringArray = mockData.stringArray(5) //  ['trlRvjW', 'RMfzv4C6Q', 'EFcwsSL', '7gFB3Z93U', 'l7wMHB9']

// Generate a number within a specified range
const randomNumberInRange = mockData.numberInRange(10, 50); // 26

// Generate a date within a specified range, returns the date in ISO format
const randomDate = mockData.dateInRange(new Date(2000, 0, 1), new Date(), {
    returnIsoDate: true,
}); // 2006-11-23T02:10:48.935Z

// Generate a fake user name
const randomUserName = mockData.name(); // Mark

// Generate a fake user last name
const randomUserLastName = mockData.lastName(); // Martinez

// Generate a fake full name
const randomFullName = mockData.fullName(); // John Harris

// Generate a fake address
const randomAddress = mockData.address(); 
//   address: {
//      country: 'USA',
//      state: 'IL',
//      city: 'New York',
//      street: 'Main St',
//      postalCode: '90001'}

// Generate a fake email with the given name
const randomEmail = mockData.email('john'); // [email protected]

// Generate a fake phone number
const randomPhoneNumber = mockData.phoneNumber(); // +75820672346

// Generate a fake password
const randomPass = mockData.password(); // 2?8hFgWk

// Generate a fake user
const randomUser = mockData.user();
// {
//    email: "[email protected]"
//    firstName: "Margaret"
//    lastName: "Moore"
//    phoneNumber: "+78622944804"
//    address: {
//       country: 'USA',
//       state: 'IL',
//       city: 'New York',
//       street: 'Main St',
//       postalCode: '90001'}
// }

// Generate a fake product
const randomProduct = mockData.product();
// {
//     name: GsgTa,
//     category: 'Electronics',
//     price: 6235,
//     description: 'Mango banana date honeydew date mango honeydew mango lemon grape mango cherry banana nectarine lemon honeydew grape date wildberry cherry'
// }

Author: ker4ik13

Support and Feedback

If you have any questions, issues, or suggestions for improvement, you can create a new Issue on the repository page at https://github.com/ker4ik13/easy-mock-data/issues