format-people
Format a list of authors, contributors, or collaborators.
Last updated 6 years ago by jonschlinkert .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install format-people 
SYNC missed versions from official npm registry.

format-people NPM version NPM monthly downloads NPM total downloads Linux Build Status

Format a list of authors, contributors, or collaborators.

Please consider following this project's author, Brian Woodward, and consider starring the project to show your :heart: and support.

Install

Install with npm:

$ npm install --save format-people

Usage

Requires Node.js v8.0 or higher.

const format = require('format-people');

API

Params

  • arr {Array}: Array of people objects.
  • format {String}: The format "type" to use. Valid types are table, list and aligned. If no type is passed, table will be used automatically.
  • returns {String}: Formatted

Example

const people = [ { name: 'Brian Woodward' } ];
const table = format(people, 'table');
console.log(table);

.table

Returns the array of people formatted as a markdown table.

Params

  • arr {Array}: Array of people to format.
  • returns {String}: Markdown table

Example

const people = [
  { login: 'doowb', contributions: 100, html_url: 'https://github.com/doowb' },
  { login: 'jonschlinkert', contributions: 50, html_url: 'https://github.com/jonschlinkert' }
];
console.log(format.table(people));
//=> | **Commits** | **Contributor**<br/> |
//=> | --- | --- |
//=> | 100 | [doowb](https://github.com/doowb) |
//=> | 50 | [jonschlinkert](https://github.com/jonschlinkert) |

.list

Returns the array of people formatted as a markdown list.

Params

  • arr {Array}: Array of people to format.
  • returns {String}: Markdown list

Example

const people = [
  { login: 'doowb', contributions: 100, html_url: 'https://github.com/doowb' },
  { login: 'jonschlinkert', contributions: 50, html_url: 'https://github.com/jonschlinkert' }
];
console.log(format.list(people));
//=> **Commits** / **Contributor**
//=> + 100 [doowb](https://github.com/doowb)
//=> + 50 [jonschlinkert](https://github.com/jonschlinkert)

.aligned

Returns the array of people formatted as a GitHub Flavored Markdown fenced code block, with aligned columns.

Params

  • arr {Array}: Array of people to format.
  • returns {String}: Markdown code block with aligned columns.

Example

const people = [
  { login: 'doowb', contributions: 100, html_url: 'https://github.com/doowb' },
  { login: 'jonschlinkert', contributions: 50, html_url: 'https://github.com/jonschlinkert' }
];
console.log(format.aligned(people));
//=> COMMITS / CONTRIBUTOR
//=> ------- | -----------
//=> 100      doowb
//=> 50      jonschlinkert

About

<summary>Contributing</summary>

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.

Please read the contributing guide for advice on opening issues, pull requests, and coding standards.

<summary>Running Tests</summary>

Running and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:

$ npm install && npm test
<summary>Building docs</summary>

(This project's readme.md is generated by verb, please don't edit the readme directly. Any changes to the readme must be made in the .verb.md readme template.)

To generate the readme, run the following command:

$ npm install -g verbose/verb#dev verb-generate-readme && verb

Related projects

You might also be interested in these projects:

Contributors

Commits Contributor
11 doowb
8 jonschlinkert

Author

Brian Woodward

License

Copyright © 2018, Brian Woodward. Released under the MIT License.


This file was generated by verb-generate-readme, v0.6.0, on August 14, 2018.

Current Tags

  • 1.0.1                                ...           latest (6 years ago)

7 Versions

  • 1.0.1                                ...           6 years ago
  • 1.0.0                                ...           6 years ago
  • 0.1.4                                ...           8 years ago
  • 0.1.3                                ...           8 years ago
  • 0.1.2                                ...           8 years ago
  • 0.1.1                                ...           8 years ago
  • 0.1.0                                ...           8 years ago
Maintainers (2)
Downloads
Total 0
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (0)
None
Dev Dependencies (2)

© 2010 - cnpmjs.org x YWFE | Home | YWFE