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

mimeo-js

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mimeo-js

Quickly generate random data

latest
npmnpm
Version
2.0.5
Version published
Maintainers
1
Created
Source

Mimic sample data.

Migration to v2

See Functions



Usage

const mimic = require('mimeo-js').mimic;
const sampleData = {
    name: 'John Doe',
    gender: (chance) => chance.pickone(['male','female']);
}

console.log(mimic(sampleData)); // Different each time
console.log(mimic(sampleData, true)); // Will always be same whenever ran
console.log(mimic(sampleData, {seed: 'someSeed')); // Will always be same whenever ran using same seed

Args

  • data {any}

The data to be mimicked. Tries to get an approximately similar data item.

Objects

Objects have each key recursively called.

Functions

If the data value is a function, it is called with one parameter, a chance instance. The mimicked value will be the return value of the function:

  • opts {shouldSeed | generatorOpts}

Is either a boolean (shouldSeed) or an object(generatorOpts). See below.

shouldSeed {boolean}

You can get repeatable values by passing true as the second parameter of the mimic function

generatorOpts {object}
{
   seed {any}: The seed that will be used.
}

FAQs

Package last updated on 09 Oct 2020

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