stuffd
I like my data how I like my turkeys. Stuffd. 🦃
Create lots of random data, nested or relational (or both) and do whatever you want with it. Output the JSON, manipulate it in TS/JS land, or pipe each object into your database (both objectMode and standard stream suppported)!
Installation
npm i stuffd
Features:
- Fluid API or TypeScript Decorators for super smooth model definitions.
- Easily create heaps of nested or relational data in milliseconds.
- CLI tool for kickin' back and running tasks.
- Works perfectly with gulp/grunt/any task runner.
- Packed full of tests, so dense. Over 230 tests and counting!
Examples
Basic (Nested with Fluent API)
cosnt Stuffd Context = ; // Create Typescript-like enums with explicit integers! const ModuleType = Stuffd; // Create Typescript-like enums with implicit integers! const ModuleSize = Stuffd; // Create custom, re-usable attributes! const personName = ` `; const Manufacturer = Stuffd ; const Engine = Stuffd ; const Module = Stuffd ; const Spaceship = Stuffd ; // Optionally provide a seed (same seed + same operations = same result) const ctx = 2187; const fleet = ctx; console; // Prints out ALL the ship details...
Basic (Relational with Decorators)
;; ; // Create array of 50 students...;// [...] ;// [...] // Create array of 5 classes referencing a teacher's id from the 3 in that list...;// [...] // Create array of grades, using the 3 classes above for the classId and making one for each student.;// [...] ;// true // Get an object with all the instances created...;// { "Student": [...], "Teacher": [...], etc. } ; // Formatted// '{ "Student": [...], "Teacher": [...], etc. }' // Pipe the data somewhere!ctx.stream.pipemyDbInserter;// { "type": "Student", "value": { ... } } // Pipe the JSON somewhere!ctx.stream.pipemyFileInserter;// (same as above but 1 per line)
CLI
// Docs coming soon! (see ~/examples/stuffd.typescript.ts for example)
stuffd run default --seed 2319 stuffd create Spaceship 2 > ships.json
Contribute
- Fork it
npm i
npm run watch
- Make changes and write tests.
- Send pull request! 😎
License:
MIT