You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
405 B

'use strict';
module.exports = function join(glue, finalGlue) {
var collection = this.values();
if (finalGlue === undefined) {
return collection.implode(glue);
}
var count = collection.count();
if (count === 0) {
return '';
}
if (count === 1) {
return collection.last();
}
var finalItem = collection.pop();
return collection.implode(glue) + finalGlue + finalItem;
};