HOME


sh-3ll 1.0
DIR:/proc/thread-self/cwd/bright.medisavehealthcarebd.com/node_modules/collect.js/src/methods/
Upload File :
Current File : //proc/thread-self/cwd/bright.medisavehealthcarebd.com/node_modules/collect.js/src/methods/join.js
'use strict';

module.exports = function join(glue, finalGlue) {
  const collection = this.values();

  if (finalGlue === undefined) {
    return collection.implode(glue);
  }

  const count = collection.count();

  if (count === 0) {
    return '';
  }

  if (count === 1) {
    return collection.last();
  }

  const finalItem = collection.pop();

  return collection.implode(glue) + finalGlue + finalItem;
};