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

farzi.js

v1.0.6

Published

A Package to generate mock data for your projects

Downloads

19

Readme

Farzi.js

Farzi.js is a powerful JavaScript library designed to generate good quality of realistic fake data for both browser and Node.js environments. Ideal for testing and development purposes, Farzi.js offers a wide range of data types, including but not limited to names, addresses, phone numbers, and more.

Get Started

Logo

Installation

Install farzi.js with npm

  npm install farzi.js

Import

Use ES6 Module Import to import the package

  import farzi from 'farzi.js';

OR

Use traditonal method (CommonJS)

  const farzi = require('farzi.js');

Usage/Examples

1) Generate Fake Name

It can generate Fake Name using two methods firstName() and fullName()

Get First Name Only

const name = farzi.firstName();
console.log(name); //Adam

Get Full Name

const name = farzi.fullName();
console.log(name); //Adam Smith

2) Generate Number

It can generate number by two methods getRange(min, max) and getNumber(length)

Get number between a specified range

const number = farzi.number.getRange(0, 100);

console.log(number); //4
console.log(number); //87
console.log(number); //45

Get number by length

const number = farzi.number.getNumber(10);
console.log(number); //6767897653

const number = farzi.number.getNumber(4);
console.log(number); //4587

const number = farzi.number.getNumber(2);
console.log(number); //23

3) Generate Email

Generate fake email using method email()

Get email by this method

const email = farzi.email();

console.log(email); // [email protected]
console.log(email); // [email protected]
console.log(email); // [email protected]

4) Generate Fake addresses

Generate Fake Addresses using address()

Get Full Address

const address = farzi.address.getFullAddress();
console.log(address); // 59596 Curry Shoals Clarkchester, IA 32671

Get city name only

const address = farzi.address.getCity();
console.log(address); // Nataliebury

Get state name only

const address = farzi.address.getState();
console.log(address); // Utah

Get postal code

const address = farzi.address.getPostalCode();
console.log(address); // 97114

Get country name only

const address = farzi.address.getCountry();
console.log(address); // India

Get country code

const address = farzi.address.getCountryCode();
console.log(address); // KG

5) Generate Fake Images

Generate Fake Addresses using image()

Get random images using image(width, height) Accepts width and height of the image and returns the image in specified size. (Leaving it blank will give the size of 400x400 px)

const image = farzi.image(250, 500);
console.log(image); // https://picsum.photos/250/500

const img = farzi.image();
console.log(img); // https://picsum.photos/400/400

6) Generate Date and Time

Generate date and time using date object. It supports 3 methods i.e currentDate() currentTime() epochTime(type)

Get Current Date in ISO Format

const date = farzi.date.currentDate();
console.log(date); // 2024-04-11T12:19:01.401Z

Get Current Time in hh:mm:ss aa format

const time = farzi.date.currentTime();
console.log(time); // 5:50:29 PM

Get Current Time in epoch (seconds) specified

const epoch = farzi.date.epochTime('s');
console.log(epoch); // 1712838155

Get Current Time in epoch (milliseconds) specified

const epoch = farzi.date.epochTime('ms');
console.log(epoch); // 1712838149303

Get Current Time in epoch (nothing specified)

const epoch = farzi.date.epochTime();
console.log(epoch); // 1712838155

7) Generate Fake Card Details

Generate fake card details using card() method.

Get random fake card details using card() method. No need to specify something here. It will automaticallly generate details such as Card Number, Card Owner Name, Expiry, CVV, Card Type.

const cardDetails = farzi.card();
console.log(cardDetails);

// {
  "Card": "American Express",
  "Owner Name": "Larry Chad",
  "Card Number": 2402400982696908,
  "expiry": "07/29",
  "cvv": 444
}

Use JSON.parse(cardDetails) to convert this back to javascript object.

Authors

Conclusion

If you like this package, show your support & love!

buy me a coffee