compound-subject
A tiny JavaScript library for converting arrays of strings to compound subjects
Last updated 9 years ago by adamshaylor .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install compound-subject 
SYNC missed versions from official npm registry.

compound-subject

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

Installation

Node

In your project directory:

npm install --save compound-subject

At the top of your module:

var compoundSubject = require('compound-subject');

Bower

In your project directory:

bower install --save compound-subject

In your HTML:

<script src="bower_components/compound-subject/compound-subject.min.js"></script>

Or if you want the dev version:

<script src="bower_components/compound-subject/compound-subject.js"></script>

compoundSubject will be defined in the global scope (i.e. window).

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'

Current Tags

  • 0.0.2                                ...           latest (9 years ago)

3 Versions

  • 0.0.2                                ...           9 years ago
  • 0.0.1                                ...           12 years ago
  • 0.0.0                                ...           12 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (0)
None
Dev Dependencies (3)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |