diff --git a/src/helpers/common.js b/src/helpers/common.js new file mode 100644 index 0000000..42259a0 --- /dev/null +++ b/src/helpers/common.js @@ -0,0 +1,10 @@ +export function trim (str) { + if (!str) return str + return str.replace(/^\s+|\s+$/g, '') +} + + +export function toCommaList (arr, key = 'name') { + if (!arr) return + return arr.map(item => item[key]).join(', ') +}