1.1.0 • Published 6 years ago

mad-libber v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
6 years ago

mad-libber

Creates a random sentence by replacing keywords - mad libs style.

Install

$ npm install --save mad-libber

Usage

const madlibs = require('mad-libber');

const sentence = '${noun1} likes ${?to? verb1}. ${noun2} likes ${?to? verb2}.';
const data = {
  noun: ["Tim", "MM", "Dan"],
  verb: ["?to? party", "?to? sleep", "staring, slack-jawed, into the abyss"]
};

madlibs(sentence, data);
//=> "MM likes to party. Tim likes to sleep."