UNPKG

@jharrilim/madlibs

Version:

randomized madlibs templating engine

35 lines (25 loc) 1.1 kB
# MadLibs [![Build Status]](https://dev.azure.com/josephharrisonlim/josephharrisonlim/_build/latest?definitionId=4&branchName=master) [![Version]](https://www.npmjs.com/package/@jharrilim/madlibs) [![Downloads]](https://www.npmjs.com/package/@jharrilim/madlibs) > An entirely useless MadLibs library that demonstrates how you can process tagged template strings. ## Install ```sh npm i @jharrilim/madlibs ``` ## Usage ```ts import { MadLibs } from '@jharrilim/madlibs'; const madlibs = new MadLibs({ adjective: ['speedy'], noun: ['sloth', 'ocean'], 'verb ending in ing': ['flying'], }); console.log(madlibs.compile` The ${"adjective"} ${"noun"} was ${"verb ending in ing"} over the ${"noun"} `.join('')); // Output: The speedy sloth was flying over the ocean ``` [Version]: https://img.shields.io/npm/v/@jharrilim/madlibs?style=flat-square [Downloads]: https://img.shields.io/npm/dt/@jharrilim/madlibs?style=flat-square [Build Status]: https://dev.azure.com/josephharrisonlim/josephharrisonlim/_apis/build/status/jharrilim.madlibs?branchName=master