restructured aggregation
This commit is contained in:
		@@ -1,7 +1,13 @@
 | 
			
		||||
import {parseAsync} from 'json2csv';
 | 
			
		||||
 | 
			
		||||
export default function csv(input: any[], f: (err, data) => void) {
 | 
			
		||||
  parseAsync(input.map(e => flatten(e)))
 | 
			
		||||
  console.log(input[1000]);
 | 
			
		||||
  console.log(flatten(input[1000]));
 | 
			
		||||
  parseAsync([flatten(input[1000])]).then(csv => console.log(csv));
 | 
			
		||||
  console.log(input[1]);
 | 
			
		||||
  console.log(flatten(input[1]));
 | 
			
		||||
  parseAsync([flatten(input[1])]).then(csv => console.log(csv));
 | 
			
		||||
  parseAsync(input.map(e => flatten(e)), {includeEmptyRows: true})
 | 
			
		||||
    .then(csv => f(null, csv))
 | 
			
		||||
    .catch(err => f(err, null));
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user