Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const result = [
- {
- Id: "1",
- Char1: "a; b; c",
- Char2: "d; e; f"
- }
- ];
- Id,Char1,Char2
- 1,a,d
- 1,b,e
- 1,c,f
- Id,Char1,Char2
- 1,a,d
- 1,a,e
- 1,a,f
- 1,b,d
- 1,b,e
- 1,c,f
- 1,c,d
- 1,c,e
- 1,c,f
- result
- .reduce((acc, {
- Id,
- Char1,
- Char2
- }) => {
- const a = Char1.split(";");
- const c = Char2.split(";");
- a.forEach((item, index) => {
- acc.push({
- Id: Id,
- Char1: item,
- Char2: c[index]
- });
- });
- return acc;
- }, [])
- .forEach(item => {
- lines.push(rowData.map(key => item[key]).join(","));
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement