toCSV comma fix
This commit is contained in:
		| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
| 	"name": "@ztimson/utils", | 	"name": "@ztimson/utils", | ||||||
| 	"version": "0.23.18", | 	"version": "0.23.19", | ||||||
| 	"description": "Utility library", | 	"description": "Utility library", | ||||||
| 	"author": "Zak Timson", | 	"author": "Zak Timson", | ||||||
| 	"license": "MIT", | 	"license": "MIT", | ||||||
|   | |||||||
| @@ -81,7 +81,7 @@ export function toCsv(target: any, flatten=true) { | |||||||
| 			const value = dotNotation<any>(row, h); | 			const value = dotNotation<any>(row, h); | ||||||
| 			if(value == null) return ''; | 			if(value == null) return ''; | ||||||
| 			if(typeof value == 'object') return `"${JSONSanitize(value).replaceAll('"', '""')}"`; | 			if(typeof value == 'object') return `"${JSONSanitize(value).replaceAll('"', '""')}"`; | ||||||
| 			if(typeof value == 'string' &&  /[\n"]/g.test(value)) return `"${value.replaceAll('"', '""')}"`; | 			if(typeof value == 'string' &&  /[\n",]/g.test(value)) return `"${value.replaceAll('"', '""')}"`; | ||||||
| 			return value; | 			return value; | ||||||
| 		}).join(',')) | 		}).join(',')) | ||||||
| 	].join('\n'); | 	].join('\n'); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user