Last active
February 11, 2019 14:00
-
-
Save devuo/328433d716cbe6ffa3d019ee2723ed51 to your computer and use it in GitHub Desktop.
Table Data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface Data { | |
clients: { | |
clientId: number, | |
errorConfigurations: { | |
userGroup: { | |
id: string | |
}, | |
error: { | |
message: string | |
} | |
}[] | |
}[] | |
} | |
interface TableRow { | |
usedIn: string, | |
errorMessage: string, | |
clientId: number | |
} | |
const data: Data = { | |
clients: [ | |
{ | |
clientId: 12, | |
errorConfigurations: [ | |
{ | |
error: { | |
message: 'Oh noes' | |
}, | |
userGroup: { | |
id: 'oh-no' | |
} | |
} | |
] | |
} | |
] | |
}; | |
const table: TableRow[] = []; | |
for (const client of data.clients) { | |
for (const config of client.errorConfigurations) { | |
table.push({ | |
errorMessage: config.error.message, | |
usedIn: config.userGroup.id, | |
clientId: client.clientId | |
}) | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment