Skip to content

Latest commit

 

History

History
69 lines (49 loc) · 1.08 KB

.verb.md

File metadata and controls

69 lines (49 loc) · 1.08 KB

Usage

const listitem = require('{%= name %}');

Examples

Basic list

Generate a list using default bullets and indentation:

const listitem = require('{%= name %}');
const li = listitem();

let list = ['a', 'b', 'c', 'd', 'e'].map((ele, i) => li(i, ele));
console.log(list.join('\n'));

Results in:

- a
  * b
    + c
      - d
        * e

Roman numerals

Generate roman numerals in increments of 10.

const listitem = require('{%= name %}');
const romanize = require('romanize');

// specify `chars` to pass to fill-range, and use the callback 
// to modify generated numerals
const li = listitem({ chars: '1..100..10' }, (indent, ch) => {
  return indent + romanize(ch) + '.';
});

// generate a formatted list!
let list = ['a', 'b', 'c', 'd', 'e'].map((ele, i) => li(i, ele));
console.log(list.join('\n'));

Results in:

I. a
  XI. b
    XXI. c
      XXXI. d
        XLI. e

API

{%= apidocs("index.js") %}

Release History

2.0.0 - July 5, 2018

Breaking changes

  • The callback signature has changed to (indent, char, level).