JSPM

compound-subject

0.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 16648
  • Score
    100M100P100Q139805F
  • License MIT

A tiny JavaScript library for converting arrays of strings to compound subjects

Package Exports

  • compound-subject

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (compound-subject) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

compound-subject

A tiny JavaScript library for converting arrays of strings to compound subjects

Installation

Node:

npm install compound-subject

Bower:

bower install compound-subject

Usage

compoundSubject(['apple', 'banana', 'cherry']).make();

// 'apple, banana and cherry'


compoundSubject(['apple', 'banana', 'cherry'])
    .endWith('or')
    .make();

// 'apple, banana or cherry'


compoundSubject(['apple', 'banana', 'cherry'])
    .delimitAll()
    .endWith('and maybe')
    .make();

// 'apple, banana, and maybe cherry'


compoundSubject([
    'a very crunchy Honeycrisp apple',
    'bananas at the pinnacle of ripeness',
    'delectable halved Rainier cherries'
]).delimitWith(';')
    .delimitAll()
    .make();

// 'a very crunchy Honeycrisp apple; bananas at the pinnacle of ripeness; and delectable halved Rainier cherries'