New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

@aux4/faker

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aux4/faker

CLI to generate fake data

latest
Source
npmnpm
Version
0.0.7
Version published
Maintainers
1
Created
Source

@aux4/faker

CLI to generate fake data

npm

Install

npm install -g @aux4/faker

Usage

This uses faker to generate fake data. See all the available options.

fake value

$ aux4-faker fake value <module> <method> [args/params]

e.g.:

$ aux4-faker fake value person firstName
Tommy

$ aux4-faker fake value person firstName female
Nora

$ aux4-faker fake value number int min=1 max=10
6

Generating multiple values:

$ aux4-faker fake value person firstName --count 3
[
  "Leslie",
  "Daren",
  "August"
]

$ aux4-faker fake value person firstName --min 3 --max 5
[
  "Harmony",
  "Vickie",
  "Icie",
  "Nils"
]

fake object

config.yaml

config:
    person:
      mapping:
        firstName:
          fake: person firstName
        lastName:
          fake: person lastName
        age:
          fake:
            value: number int
            params:
              min: 18
              max: 90
$ aux4-faker fake object --config <config path>

$ aux4-faker fake object --config person
{
  "firstName": "Priscilla",
  "lastName": "Mraz",
  "age": 69,
}

Generating multiple objects:

$ aux4-faker fake object --config person --count 3
[
  {
    "firstName": "Minnie",
    "lastName": "Simonis",
    "age": 63
  },
  {
    "firstName": "Sandy",
    "lastName": "McCullough",
    "age": 18
  },
  {
    "firstName": "Vicki",
    "lastName": "Langworth",
    "age": 28
  }
]

$ aux4-faker fake object --config person --min 1 --max 3
[
  {
    "firstName": "Myra",
    "lastName": "Mueller",
    "age": 90
  },
  {
    "firstName": "Sheryl",
    "lastName": "Hartmann",
    "age": 40
  }
]

Generating nested objects:

config:
  person:
    mapping:
      firstName:
        fake:
          value: person firstName
          args:
            - female
      lastName:
        fake: person lastName
      age:
        fake:
          value: number int
          params:
            min: 18
            max: 90
      address:
        type: array
        fake:
          options:
            min: 0
            max: 2
        mapping:
          street:
            fake: location streetAddress
          city:
            fake: location city
          state:
            fake: location state
          zip:
            fake: location zipCode
$ aux4-faker fake object --config person
{
  "firstName": "Robyn",
  "lastName": "Rau",
  "age": 19,
  "address": [
    {
      "street": "21506 Beulah Fork",
      "city": "Janabury",
      "state": "Oklahoma",
      "zip": "15669-9735"
    }
  ]
}

If you want to have the address as an object instead of array, you can replace it:

address:
  type: object
  mapping:
    street:
      fake: location streetAddress
    city:
      fake: location city
    state:
      fake: location state
    zip:
      fake: location zipCode
$ aux4-faker fake object --config person

{
  "firstName": "Veronica",
  "lastName": "Lind",
  "age": 36,
  "address": {
    "street": "31102 Royce Route",
    "city": "North Willafield",
    "state": "Georgia",
    "zip": "15127"
  }
}

Keywords

aux4

FAQs

Package last updated on 05 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts