format-people
Format a list of authors, contributors, or collaborators.
Install
Install with npm:
$ npm install --save format-people
Usage
var format = require('format-people');
API
Format a list of people like objects (e.g. authors, contributors, and collaborators) into the specified format.
Params
arr
{Array}: Array of people objects.options
{Object}: Additional optionsoptions.format
{String}: Formatter function used to format the array. See formatters for more details.returns
{Mixed}: Formatted array of people. Returned type depends on formatter.
Example
var people = [
{ name: 'Brian Woodward' }
];
var table = format(people, {format: 'table'});
console.log(table);
Formatters
Returns the array as-is without any formatting.
Params
arr
{Array}: Array of people to format.returns
{Array}: Unmodified array of people.
Example
var people = [
{ login: 'doowb' }
];
var formatted = formatters.noop(people);
console.log(formatted);
Returns the array of people formatted as a markdown table.
Params
arr
{Array}: Array of people to format.returns
{String}: Markdown table
Example
var people = [
{ login: 'doowb', contributions: 100, html_url: 'https://github.com/doowb' },
{ login: 'jonschlinkert', contributions: 50, html_url: 'https://github.com/jonschlinkert' }
];
var formatted = formatters.table(people);
console.log(formatted);
Returns the array of people formatted as a markdown list.
Params
arr
{Array}: Array of people to format.returns
{String}: Markdown list
Example
var people = [
{ login: 'doowb', contributions: 100, html_url: 'https://github.com/doowb' },
{ login: 'jonschlinkert', contributions: 50, html_url: 'https://github.com/jonschlinkert' }
];
var formatted = formatters.list(people);
console.log(formatted);
Returns the array of people formatted as an aligned code block.
Params
arr
{Array}: Array of people to format.returns
{String}: Markdown code block for alignment
Example
var people = [
{ login: 'doowb', contributions: 100, html_url: 'https://github.com/doowb' },
{ login: 'jonschlinkert', contributions: 50, html_url: 'https://github.com/jonschlinkert' }
];
var formatted = formatters.aligned(people);
console.log(formatted);
About
Related projects
Contributing
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Please read the contributing guide for avice on opening issues, pull requests, and coding standards.
Building docs
(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)
To generate the readme and API documentation with verb:
$ npm install -g verb verb-generate-readme && verb
Running tests
Install dev dependencies:
$ npm install -d && npm test
Author
Brian Woodward
License
Copyright © 2016, Brian Woodward.
Released under the MIT license.
This file was generated by verb-generate-readme, v0.1.31, on September 21, 2016.