Converts an author object or array of author objects into an array of strings. Useful for adding authors, maintainers or contributors to documentation, package.json or a readme.
Install with npm
$ npm i stringify-authors --save
var authors = require('stringify-authors');
Given an array of author objects:
var authors = [{
name: 'Jon Schlinkert',
email: '[email protected]',
url: 'https://github.com/jonschlinkert'
}, {
name: 'Brian Woodward',
url: 'https://github.com/doowb',
email: '[email protected]'
}]
// default separator is ', '
stringify(authors, {sep: '\n'});
results in:
Jon Schlinkert <[email protected]> (https://github.com/jonschlinkert)
Brian Woodward <[email protected]> (https://github.com/doowb)
stringify(authors, {filter: 'name'});
//=> Jon Schlinkert, Brian Woodward
stringify(authors, {filter: '{name,url}', sep: '\n'});
// Jon Schlinkert (https://github.com/jonschlinkert)
// Brian Woodward (https://github.com/doowb)
- author-regex: Regular expression for parsing an
author
string into an object following npm conventions. | homepage - parse-author: Parse a string into an object with
name
,email
andurl
properties following npm conventions.… more | homepage - parse-authors: Parse a string into an array of objects with
name
,email
andurl
properties following… more | homepage - stringify-author: Stringify an authors object to
name <email> (url)
. | homepage
Install dev dependencies:
$ npm i -d && npm test
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Jon Schlinkert
Copyright © 2015 Jon Schlinkert Released under the MIT license.
This file was generated by verb-cli on November 16, 2015.