Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

listify

ljharb467.3kMIT1.0.3TypeScript support: definitely-typed

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

list, listify, array, comma, comma-separated, csv, oxford comma

readme

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

changelog

Changelog

All notable changes to this project will be documented in this file.

The format is based on Keep a Changelog and this project adheres to Semantic Versioning.

Generated by auto-changelog.

v1.0.3 - 2020-05-03

Commits

  • [Robustness] remove has; call-bind all prototype methods 303d9cd

v1.0.2 - 2020-05-01

Fixed

  • Revert "[Robustness] use string.prototype.trim" #9

Commits

v1.0.1 - 2020-04-12

Commits

  • [Tests] use shared travis-ci configs 7d9a712
  • [Tests] up to node v12.6, v11.15, v10.16, v9.11, v8.16, v7.10, v6.17, v5.12, v4.9, iojs-v3.3; use nvm install-latest-npm d72fb2e
  • [Tests] remove jscs 1479506
  • Using my standard jscs.json 0eb58fd
  • Adding npm run lint c7f45d9
  • [meta] add auto-changelog be596c1
  • Update tape, covert, jscs 58ec7b4
  • [Dev Deps] update eslint, @ljharb/eslint-config, covert, tape d905bbc
  • Test on io.js 4d11405
  • Update tape, jscs ac9236a
  • Add npm run eslint d27cee1
  • [actions] add automatic rebasing / merge commit blocking c446f23
  • [Dev Deps] update eslint, @ljharb/eslint-config; add safe-publish-latest 75a713e
  • [Dev Deps] update tape, eslint, jscs 30cac3a
  • iNaming deps/devDeps URLs in README d474a56
  • [Tests] up to node v12.11 dd857f0
  • [meta] add FUNDING.yml d7ee847
  • [Tests] add some tests around whitespace 77e4f83
  • [Tests] use npx aud instead of nsp or npm audit with hoops 4572df1
  • Use has instead of unreliable hasOwnProperty check. fd66deb
  • Test up to io.js v2.5 39bda02
  • [Dev Deps] update eslint, @ljharb/eslint-config, safe-publish-latest, tape 0d3cd67
  • [Robustness] use string.prototype.trim f645b49
  • Add npm run security d6b897d
  • Naming travis-ci URLs in README 63f7007
  • [Tests] add npm run tests-only; clean up scripts 1c83511
  • Only apps should have lockfiles 7b0c71a
  • All grade A-supported node/iojs versions now ship with an npm that understands ^. 11d3a87
  • Run travis-ci tests on iojs and node v0.12; speed up builds; allow 0.8 failures. f6c58c5
  • Use SVG badges instead of PNG 373dd91
  • [Dev Deps] update auto-changelog, tape dfdcc09
  • [Dev Deps] update @ljharb/eslint-config, tape 3aeae1d
  • Update tape, jscs ff732c0
  • Update jscs 68521e7
  • Update tape, jscs 38a90e6
  • Update tape, jscs f27b95d
  • Using consistent quotes. e75fb3e
  • Naming npm version badge SVG in README 4b66e49
  • Naming npm package URL in README 8b0dce9
  • [Dev Deps] update auto-changelog; add aud 1575892
  • [meta] add funding field 2a95788
  • Moving the strict mode declaration higher up. d27dd51
  • [Tests] only audit prod deps dcf6692
  • [Deps] update string.prototype.trim 3d1c764
  • [Deps] update string.prototype.trim f478071
  • [Deps] update has 6864547
  • [Dev Deps] update tape 01943db
  • Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG. 254bf09
  • Update tape 81ecc33
  • Update tape cd2b4af
  • Lock covert to v1.0.0. 0d871a2
  • Updating jscs 3c4634c
  • Updating tape 042773f
  • Updating jscs 956a3ff
  • Updating jscs 8599356
  • Adding coverage as part of tests. 1a15eea
  • Running lint as part of tests. c9cff98
  • Test on io.js v3.0 a78d701

v1.0.0 - 2014-08-13

Commits

v0.0.1 - 2013-09-07

Commits