(strings, endDelineator = 'and')
| 17 | * @return {String} human - friendly list |
| 18 | */ |
| 19 | export default function stringList(strings, endDelineator = 'and') { |
| 20 | const progress = []; |
| 21 | strings.forEach((s, i) => { |
| 22 | if (i > 0) { |
| 23 | if (i === strings.length - 1) { |
| 24 | if (progress.length > 1) { |
| 25 | progress.push(','); |
| 26 | } |
| 27 | progress.push(` ${endDelineator} `); |
| 28 | } else { |
| 29 | progress.push(', '); |
| 30 | } |
| 31 | } |
| 32 | progress.push(s); |
| 33 | }); |
| 34 | return progress.join(''); |
| 35 | } |
no outgoing calls
no test coverage detected