Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

gennifer

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gennifer

Fake social data generator

latest
Source
npmnpm
Version
0.2.1
Version published
Maintainers
1
Created
Source

Deps

  npm install

Usage & installation

As a module

  npm install gennifer --save

  var gennifer = require( 'gennifer' )();
  var tweetTmpl = function() {
    return {
      user: '@recursivefunk',
      text: 'I am the one'
    };
  };

  gennifer.registerTemplate( 'tweet', tweetTmpl );

  // generate a data item
  var item = gennifer.generate( 'tweet' );

  // use a stream

  gennifer
    // optional
    .channel( anEventEmitter )
    // will return the genrated data and automatically emit the new data
    .pipeGen( 'tweet' );

Loading templates from a file


  // in templates.js

  // casual is the preferred underlying data generator but you can generate
  // data with your templates in any manner you wish
  var casual = require('casual');

  module.exports = {
    aTemplate: function() {
      return {
        dateFoo: casual.date,
        aName: casual.name
      }
    }
  }

  // later...
  gennifer.loadTemplates( './templates.js' );
  var templates = gennifer.templates();
  console.log( templates );
  // { aTemplate: [Function] }

As a standalone-socket server

  [sudo] npm install -g gennifer
  genneifer [ -f 1000 -v 1 -p 8080 -t ]

Just type

  genneifer -h

For available options

Streams

Gennifer is also a native nodejs stream.

    gennifer
      .on('data', function( items ){
        // do something perhaps
      })
      .pipeGen( 'tmpl1' )
      .pipe( process.stdout );    

Run Tests

You'll need to have redis running locally for all tests to pass

  npm test

To Do

Check the issues section

FAQs

Package last updated on 09 Nov 2015

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