Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

format-people

Package Overview
Dependencies
Maintainers
2
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

format-people

Format a list of authors, contributors, or collaborators.

  • 0.1.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
803
decreased by-28.5%
Maintainers
2
Weekly downloads
 
Created
Source

format-people NPM version NPM downloads Build Status

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

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 options
  • options.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

.noop

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);
//=> [{login: 'doowb'}]

.table

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);
//=> | **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

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);
//=> **Commits** / **Contributor**
//=> + 100 [doowb](https://github.com/doowb)
//=> + 50 [jonschlinkert](https://github.com/jonschlinkert)

.aligned

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);
//=> COMMITS / CONTRIBUTOR
//=> ------- | -----------
//=> 100      doowb
//=> 50      jonschlinkert

About

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.

Keywords

FAQs

Package last updated on 31 Oct 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc