add some base utilities

This commit is contained in:
axolotle
2021-06-10 13:19:32 +02:00
parent ddc19cd304
commit a7a3971fcb
+10
View File
@@ -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(', ')
}