grammarlist

1.0.0 • Public • Published

Grammar List

Function to display a list in a more grammatical fashion

Installation

npm install grammarlist --save

Usage

const grammarList = require('grammarlist')
 
let people = ['John', 'Anna', 'Casey', 'Beata']
let result = grammarList(people, 'then')
console.log(result)
 
// Expected output: Anna, Beata, Casey, then John

Signature

grammarList(list:Array, clause:String='and', sort:Boolean=true) {
  return :String
}

Tests

Grammar List

  ✓ should return a string
  ✓ should place a default clause `and` before the final item
  ✓ should allow a custom clause to be used
  ✓ should sort the list of items by default
  ✓ should allow sorting to be turned off
  ✓ should not modify the sort order of the input

Development

Clone this repo, then run:

npm install
npm test

Readme

Keywords

none

Package Sidebar

Install

npm i grammarlist

Weekly Downloads

0

Version

1.0.0

License

ISC

Last publish

Collaborators

  • johnbeech
  • markavian