npm.io
1.0.5 • Published 8 years ago

join-with-commas-and-and-before-the-last

Licence
ISC
Version
1.0.5
Deps
0
Vulns
0
Weekly
0

Join items with commas and "&" before the last item

Install

npm install join-with-commas-and-and-before-the-last --save

Method

separate(array)
separate(array, "and") // last item join with 'and'. Default is '&'
Example
var separate = require('join-with-commas-and-and-before-the-last').separate;

Separator.separate(["Emran", "Rayhan", "Mahmud"]);   // output will be "Emran, Rayhan & Mahmud"

Separator.separate(["Emran", "Rayhan"]);             // output will be "Emran & Rayhan"

Separator.separate(["Emran", "Rayhan"], ',');             // output will be "Emran, Rayhan"

Separator.separate(["Rayhan"]);                      // output will be "Rayhan"

Separator.separate(["Emran", "Rayhan", "Mahmud"], 'and');   // output will be "Emran, Rayhan and Mahmud"

Keywords