listify
Turn an array into a list of comma-separated values, appropriate for use in an English sentence.
Last updated 5 years ago by ljharb .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ npm install listify 
SYNC missed versions from official npm registry.

#listify Version Badge

Build Status dependency status dev dependency status

Turn an array into a list of comma-separated values, appropriate for use in an English sentence.

Example

var listify = require('listify');

assert(listify([1, 2]) === '1 and 2');
assert(listify([1, 2, 3]) === '1, 2, and 3');
assert(listify([1, 2, 3, 4]) === '1, 2, 3, and 4');
assert(listify([1, 2, 3], { separator: '… ' }) === '1… 2… and 3');
assert(listify([1, 2, 3], { finalWord: false }) === '1, 2, 3');
assert(listify([1, 2, 3], { separator: '… ', finalWord: 'or' }) === '1… 2… or 3');

Tests

Simply clone the repo, npm install, and run npm test

Current Tags

  • 1.0.3                                ...           latest (5 years ago)

5 Versions

  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           10 years ago
  • 0.0.1 [deprecated]           ...           11 years ago
Maintainers (1)
Downloads
Total 1
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (7)
Dependents (3)

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