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

@arti.oga/random-package

v1.1.7

Published

Random user generator

Downloads

103

Readme

Random User Generation

@arti.oga/random-package is mainly developed for the purpose of generating random users. With the help of this package we can create random users with specific attributes.

Installation

Install the package via the following command by npm

npm i @arti.oga/random-package

Then just import into your node.js project with the following lines of code

const Randomizer = require('@arti.oga/random-package')

Methods

generateUser - is used to generate a random user. You are able to pass as a parameter of the method an options object. If you want to generate a completely random user than don't pass any parameters. However, if you want to generate a user with specific values, you can pass a parameter object with a key specific.

example

Randomizer.generateUser({
  specific: {
    age: 34, firstName: 'Nancy',
  },
});
// {
//   id: '694-49-2448',
//   gender: 'male',
//   age: 34,
//   birthDay: '02.11.1988',
//   email: '[email protected]',
//   ip: '197.154.13.154',
//   userFirstName: 'Nancy',
//   userLastName: 'Nelson',
//   userFullName: 'Nancy Nelson'
// }

If we need to generate a number of different users we can pass an amount in our options as a string or number. If we pass a specific option then we will generate a list of users with specific information.

Randomizer.generateUser({
  specific: {
    idPattern: '## ## ###-###', firstName: 'Nancy',
  },
  amount: "2"
});
// [
//   {
//     id: '33 22 355-476',
//     gender: 'female',
//     age: 66,
//     birthDay: '24.05.1956',
//     email: '[email protected]',
//     ip: '241.131.102.218',
//     userFirstName: 'Nancy',
//     userLastName: 'Gonzalez',
//     userFullName: 'Nancy Gonzalez'
//   },
//   {
//     id: '73 88 557-699',
//     gender: 'male',
//     age: 74,
//     birthDay: '12.12.1947',
//     email: '[email protected]',
//     ip: '220.211.109.72',
//     userFirstName: 'Nancy',
//     userLastName: 'Carter',
//     userFullName: 'Nancy Carter'
//   }
// ]

If we are interested in specific attributes than we can pass an parameter with the key attributes. This will generate a user, however, only the attributes that we are interested in will appear.

Randomizer.generateUser({
    amount: 4,
    specific: { age: 53, firstName: 'Nancy' },
    attributes: ['age', 'email'],
  })

// [
//   { age: 53, email: '[email protected]' },
//   { age: 53, email: '[email protected]' },
//   { age: 53, email: '[email protected]' },
//   { age: 53, email: '[email protected]' }
// ]

p.s
If you want for specific attributes to be added to the package please feel free to contact via github.

p.s.s
I know that there are no test cases and the documentation might not be as good as it can be. However, there will be updates in the future. If you want to share your knowledge on package development please don't hold back and contact me.