Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
madoka is a tool to generate json data.
There is provided an online editor to edit json template.editor
npm install madoka
# install mocha first
sudo npm install mocha -g
# install dependence
npm install
# run test
npm test
var path = require('path'),
madoka = require('modoka');
var template = [
'{{ repeat(5,7) }}',
{
_id: '{{ objectId() }}',
index: '{{ index() + 1 }}',
guid: '{{ guid() }}',
isActive: '{{ bool() }}',
selfIntroduction: function(faker) {
return 'My name is ' + this.name + '. Generate before name is parsed';
},
balance: '{{floating(1000, 4000, 2, "$0,0.00")}}',
picture: '{{ image.image() }}',
age: '{{ integer(20, 40) }}',
eyeColor: '{{ random("blue", "brown", "green") }}',
name: '{{ firstName() }} {{ lastName() }}',
compay: '{{ company().toUpperCase() }}',
phone: '{{ phone() }}',
address: '{{ state() }}, {{ city() }}, {{ street() }}, {{ faker.address.zipCode() }}',
registered: '{{date(new Date(2014, 0, 1), new Date(), "YYYY-MM-dd hh:mm:ss Z")}}',
tags: [
'{{ repeat(7) }}',
'{{ lorem(1, "words") }}'
],
greeting: function(faker) {
return 'Hello, ' + this.name + ' You have ' + faker.integer(10, 100) + ' unread message';
}
}
];
console.time('build');
for(var i = 1; i < 4; i++) {
madoka.save(template, path.join(__dirname, 'build/users/' + i + '.json'));
}
console.timeEnd('build');
Generate json data.
template
: data templatevar template = '{{ firstName() }}';
console.log( madoka.generate(template) );
Generate json data and save to specified path.
template
: data templatepath
: path to save fileGenerate fake data.
Instance of faker.js , you can use all the methods faker.js provided.
returns random item from passed arguments list.
Random integer in specified range. Can be negative.
min
: Minimum number in the range.max
: Maximum number in the range.format
: Number format. For more info visit http://adamwdraper.github.io/Numeral-js/Random float in specified range.
min
: Minimum number in the range.max
: Maximum number in the range.fixed
: Number of decimalsformat
: Number format. For more info visit http://adamwdraper.github.io/Numeral-js/Random boolean value.
Random globally unique identifier.
MongoDB's globally unique identifier for objects.
Random date in specified range.
min
: Minimum date in the range. Default is new Date(1970, 0, 1).max
: Maximum date in the range. Default is new Date().format
: Date format. For more info visit http://github.com/hogart/datefRandom Lorem Ipsum text.
count
: Number of generated units. Default is 1.units
: Units type. Can be words, sentences, or paragraphs. Default is sentences.Random person name of both genders if no gender is specified.
gender
: male | femaleReturn a last name.
Random phone number.
faker.js image object.
Returns a placeholder image link. visit http://dummyimage.com.
width
: Image width, default is 640.height
: Image height, default is 480.options
: Image options.// default options
{
width: 640,
height: 480,
// array or string, background color.
bgColor: ['CCC', 'FF9C5B', 'FAD089', 'FF9C5B', 'ED303C', '3B8183'],
// array or string,text color
fgColor: ['333', 'FFF'],
format: 'png',
text: ''
}
FAQs
A json generator
The npm package madoka receives a total of 2 weekly downloads. As such, madoka popularity was classified as not popular.
We found that madoka demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
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.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.