benthos
v0.3.0
Published
ES2015 rich test data generator
Downloads
4
Readme
Benthos
- Generates massive sample data in seconds
- Works both on Browser and Node environment
- Supports Generating data from template or schema
Install
npm install benthos
Usage
In Browser
<script src="node_modules/benthos/dist/benthos.min.js"></script>
<script>
var email = benthos.email();
</script>
In CommonJS
const benthos = require('benthos');
const email = benthos.email();
In ES2015 Modules
import { email } from 'benthos'
const email = email();
Generate simple data
import { name, email, url } from 'benthos';
let name = name(); // Harry Potter
let email = email('google.com'); // [email protected]
let url = url({ host: 'markocen.com', path: 'blog' }) // http://markocen.com/blog
Generate data from template
import { compile } from 'benthos';
// bio = 'Hello, my name is Marko Cen, I'm from China'
let bio = compile('Hello, my name is {{ name }}, I\'m from {{ country }}');
Generate data from schema
import { schema } from 'benthos';
const ProfileSchema = schema({
name: '{{name}}',
age: '{{getAge}}',
gender: '{{gender(false)}}'
})
// profileData = {
// name: 'Micheal Smith',
// age: 43,
// gender: 'Male'
//}
let profileData = ProfileSchema({
getAge: function(){
return this.integer(25, 65);
}
})