1.0.0 • Published 4 months ago

commadus v1.0.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
4 months ago

commadus

Master the art of the comma.

Archetype: Node.js package
Purpose: Formats lists with elegant punctuation, including optional Oxford commas.

Commadus elegantly formats lists with proper punctuation, including support for the Oxford comma.

Details

  • Proper List Formatting – Outputs grammatically correct lists in prose.
  • Oxford Comma Support – Toggle the famous oxford comma on or off.
  • Handles Edge Cases – Works with lists of any length, from empty arrays to long item lists.
  • Lightweight & Fast – A single function, no dependencies.

Install

npm install commadus

⚙️ API

list(items, options?)

Formats an array of items into a human-readable list with optional Oxford comma.

Parameters

NameTypeDefaultDescription
itemsstring[]RequiredThe list of items to format.
optionsObject{ oxford: true }Formatting options.
options.oxfordbooleantrueWhether to include the Oxford comma before "and".

Returns

  • string – The formatted list.

Usage

import list from 'commadus';

console.log(list(['apple', 'banana', 'cherry']));
// "apple, banana, and cherry"

console.log(list(['apple', 'banana', 'cherry'], { oxford: false }));
// "apple, banana and cherry"

console.log(list(['moon', 'stars']));
// "moon and stars"

console.log(list(['sun']));
// "sun"

console.log(list([]));
// ""

Development Homepage

https://github.com/alexstevovich/commadus-node

This link might be suffixed with "-node" in the future if conflicts arise.

License

Licensed under the Apache License 2.0.