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

fake-json

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fake-json

Generate fake data based on a JSON schema.

0.0.4
Source
npm
Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

Fake JSON Build Status Dependency Status

Generate fake data based on a JSON schema.

Installation

$ npm install --save fake-json

Usage

If you are going to generate data from the same schema multiple times, do something like this:

var FakeJson = require('fake-json');

var schema = {
  "type": "array",
  "items": {
    "type": "number",
    "minimum": 1,
    "maximum": 10
  },
  "minItems": 2,
  "maxItems": 5
};

var generator = new FakeJson(schema);
generator.generate(); // => [ 6, 10, 7 ]

If you are going to generate data from different schemas each time, you can do this instead:

var FakeJson = require('fake-json');
var generator = new FakeJson();

var schema = {
  "type": "array",
  "items": {
    "type": "number",
    "minimum": 1,
    "maximum": 10
  },
  "minItems": 2,
  "maxItems": 5
};

generator.generate(schema); // => [ 8, 1, 7, 5, 7 ]

Meta

Contributors

License

Copyright (c) 2014 Daniel Perez Alvarez (unindented.org). This is free software, and may be redistributed under the terms specified in the LICENSE file.

Keywords

fake

FAQs

Package last updated on 06 Nov 2014

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