New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

amock

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

amock

Simplest data mock generator evaaaah.

  • 0.9.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2
decreased by-71.43%
Maintainers
1
Weekly downloads
 
Created
Source

amock by @michalbe

Simplest data mock generator evaaaah.

// amock.js
var amock = require('amock');

amock('cities', {
  id: "id",
  name: "names:1"
});

amock('products', {
  id: "id",
  date_of_birth: "date",
  name: "words:1",
  description: "sentences:5",
  price: "random-number:9-100",
  image: "image:500/500",
  language: "random:['en-US', 'pl', 'de', 'fr']"
});

amock('movies', {
  id: "id",
  title: "names:1"
  director: { // nested objects allowed since amock0.9
    name: "names:2",
    age: "random-numbers:20-65"
  }
});

amock.get(); // TODO: concatenate the data, now it returns first data type only
amock.get('products', 100) // array of 100 products

Supported data types:

 'id' // autoincremented number, no argument
 'date' // random date from 1970-01-01 till now
 'words' // string, number of words as an argument
 'names' // capitalized string, number of names as an argument
 'sentences' // full sentence, number of sentences as an argument
 'random-number' // random number, range as an argument (min-max)
 'image' // link to the random image, resolution as an argument (width/height)
 'sequence:ARRAY' // each element will contain element of the array, so for
                  // `code: 'sequence:[1,2,3]'`` first element will contain 1,
                  // second 2, third 3, fourth 1, fifth 2, etc...
 'random:ARRAY' // each element will contain random element of the array

Usage

npm i amock -g
amock path-to-file-with-mock-description.json [number of elements, optional] > output

FAQs

Package last updated on 22 Jun 2017

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc