UNPKG

441 BJavaScriptView Raw
1var filter = require('./filter');
2
3 function isValidString(val) {
4 return (val != null && val !== '');
5 }
6
7 /**
8 * Joins strings with the specified separator inserted between each value.
9 * Null values and empty strings will be excluded.
10 */
11 function join(items, separator) {
12 separator = separator || '';
13 return filter(items, isValidString).join(separator);
14 }
15
16 module.exports = join;
17