Socket
Socket
Sign inDemoInstall

mockdata

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

mockdata

a library to generate mock data


Version published
Maintainers
1
Weekly downloads
82
decreased by-43.06%

Weekly downloads

Readme

Source

Mock Data

All credit for this goes to clubajax. I just took the source and adapted it to work with node.js

Examples

var mock = require('../');

//random characters (min/max)
console.log(mock.chars(5, 9));

//name
console.log(mock.name());

//number (max)
console.log(mock.n(10));

//bignumber (length)
console.log(mock.bignumber(10));

//site
console.log(mock.url());

//date
console.log(mock.date({delimiter:"/", yearRange: -1 }));

//title (min/max number of words)
console.log(mock.title(3,4));

//lorem ipsum (min/max number of sentences, min/max length of words)
console.log(mock.sentences(5,10,3,8));

//real text (min/max number of sentences, min/max length of words)
mock.real = true;
console.log(mock.sentences(5,10,3,8));

//bool
console.log(mock.bool());

//color
console.log(mock.color());

//site
console.log(mock.site());

//word
console.log(mock.word());

//range
console.log(mock.range(0, 10));

//image
console.log(mock.image(100, 800, 100, 800));

Installation

npm install mockdata

Keywords

FAQs

Last updated on 08 Nov 2011

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc