my-idlers/node_modules/collect.js/dist/methods/join.js
cp6 fd22b0bf58 V2 (Laravel re-make)
V2 (Laravel re-make)
2022-03-06 02:02:12 +11:00

23 lines
405 B
JavaScript

'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;
};