1 |
|
2 |
|
3 | module.exports = function () {
|
4 | /*
|
5 | Splits strings separated by commas into an array
|
6 | If the string is empty or null, an empty array is returned.
|
7 | */
|
8 | function splitCsv (string) {
|
9 | return (string || '')
|
10 | .split(',')
|
11 | .map(s => s.trim())
|
12 | .filter(s => s.length > 0)
|
13 | }
|
14 |
|
15 | return {
|
16 | splitCsv
|
17 | }
|
18 | }
|