TS, create a recursive function that is going to return array of objects that contain code and name from the dataset:
const datatest = {
children: [
{
name: "Crop and animal production, hunting and related service activities",
code: "01",
order: 22,
localizations: [
{
languageCode: "cs",
name: "Rostlinná a živočišná výroba, myslivost a související činnosti"
},
{
languageCode: "en",
name: "Crop and animal production, hunting and related service activities"
}
],
children: [
{
name: "Growing of non-perennial crops",
code: "011",
order: 110,
localizations: [
{
languageCode: "cs",
name: "Pěstování plodin jiných než trvalých"
},
{
languageCode: "en",
name: "Growing of non-perennial crops"
}
],
children: [
{
name: "Growing of cereals (except rice), leguminous crops and oil seeds",
code: "0111",
order: 382,
localizations: [
{
languageCode: "cs",
name: "Pěstování obilovin (kromě rýže), luštěnin a olejnatých semen"
},
{
languageCode: "en",
name: "Growing of cereals (except rice), leguminous crops and oil seeds"
}
],
children: [
{
name: "Growing of cereals (except rice), leguminous crops and oil seeds",
code: "01110",
order: 997,
localizations: [
{
languageCode: "cs",
name: "Pěstování obilovin (kromě rýže), luštěnin a olejnatých semen"
},
{
languageCode: "en",
name: "Growing of cereals (except rice), leguminous crops and oil seeds"
}
],
children: []
}
]
}
]
},
{
name: "Growing of perennial crops",
code: "012",
order: 111,
localizations: [
{
languageCode: "cs",
name: "Pěstování trvalých plodin"
},
{
languageCode: "en",
name: "Growing of perennial crops"
}
],
children: [
{
name: "Growing of grapes",
code: "0121",
order: 389,
localizations: [
{
languageCode: "cs",
name: "Pěstování vinných hroznů"
},
{
languageCode: "en",
name: "Growing of grapes"
}
],
children: [
{
name: "Growing of grapes",
code: "01210",
order: 1004,
localizations: [
{
languageCode: "cs",
name: "Pěstování vinných hroznů"
},
{
languageCode: "en",
name: "Growing of grapes"
}
],
children: []
}
]
},
{
name: "Growing of tropical and subtropical fruits",
code: "0122",
order: 390,
localizations: [
{
languageCode: "cs",
name: "Pěstování tropického a subtropického ovoce"
},
{
languageCode: "en",
name: "Growing of tropical and subtropical fruits"
}
],
children: [
{
name: "Growing of tropical and subtropical fruits",
code: "01220",
order: 1005,
localizations: [
{
languageCode: "cs",
name: "Pěstování tropického a subtropického ovoce"
},
{
languageCode: "en",
name: "Growing of tropical and subtropical fruits"
}
],
children: []
}
]
},
{
name: "Growing of citrus fruits",
code: "0123",
order: 391,
localizations: [
{
languageCode: "cs",
name: "Pěstování citrusových plodů"
},
{
languageCode: "en",
name: "Growing of citrus fruits"
}
],
children: [
{
name: "Growing of citrus fruits",
code: "01230",
order: 1006,
localizations: [
{
languageCode: "cs",
name: "Pěstování citrusových plodů"
},
{
languageCode: "en",
name: "Growing of citrus fruits"
}
],
children: []
}
]
},
{
name: "Growing of pome fruits and stone fruits",
code: "0124",
order: 392,
localizations: [
{
languageCode: "cs",
name: "Pěstování jádrového a peckového ovoce"
},
{
languageCode: "en",
name: "Growing of pome fruits and stone fruits"
}
],
children: [
{
name: "Growing of pome fruits and stone fruits",
code: "01240",
order: 1007,
localizations: [
{
languageCode: "cs",
name: "Pěstování jádrového a peckového ovoce"
},
{
languageCode: "en",
name: "Growing of pome fruits and stone fruits"
}
],
children: []
}
]
},
{
name: "Growing of other tree and bush fruits and nuts",
code: "0125",
order: 393,
localizations: [
{
languageCode: "cs",
name: "Pěstování ostatního stromového a keřového ovoce a ořechů"
},
{
languageCode: "en",
name: "Growing of other tree and bush fruits and nuts"
}
],
children: [
{
name: "Growing of other tree and bush fruits and nuts",
code: "01250",
order: 1008,
localizations: [
{
languageCode: "cs",
name: "Pěstování ostatního stromového a keřového ovoce a ořechů"
},
{
languageCode: "en",
name: "Growing of other tree and bush fruits and nuts"
}
],
children: []
}
]
},
{
name: "Growing of oleaginous fruits",
code: "0126",
order: 394,
localizations: [
{
languageCode: "cs",
name: "Pěstování olejnatých plodů"
},
{
languageCode: "en",
name: "Growing of oleaginous fruits"
}
],
children: [
{
name: "Growing of oleaginous fruits",
code: "01260",
order: 1009,
localizations: [
{
languageCode: "cs",
name: "Pěstování olejnatých plodů"
},
{
languageCode: "en",
name: "Growing of oleaginous fruits"
}
],
children: []
}
]
},
{
name: "Growing of beverage crops",
code: "0127",
order: 395,
localizations: [
{
languageCode: "cs",
name: "Pěstování rostlin pro výrobu nápojů"
},
{
languageCode: "en",
name: "Growing of beverage crops"
}
],
children: [
{
name: "Growing of beverage crops",
code: "01270",
order: 1010,
localizations: [
{
languageCode: "cs",
name: "Pěstování rostlin pro výrobu nápojů"
},
{
languageCode: "en",
name: "Growing of beverage crops"
}
],
children: []
}
]
},
{
name: "Growing of spices, aromatic, drug and pharmaceutical crops",
code: "0128",
order: 396,
localizations: [
{
languageCode: "cs",
name: "Pěstování koření, aromatických, léčivých a farmaceutických rostlin"
},
{
languageCode: "en",
name: "Growing of spices, aromatic, drug and pharmaceutical crops"
}
],
children: [
{
name: "Growing of spices, aromatic, drug and pharmaceutical crops",
code: "01280",
order: 1011,
localizations: [
{
languageCode: "cs",
name: "Pěstování koření, aromatických, léčivých a farmaceutických rostlin"
},
{
languageCode: "en",
name: "Growing of spices, aromatic, drug and pharmaceutical crops"
}
],
children: []
}
]
},
{
name: "Growing of other perennial crops",
code: "0129",
order: 397,
localizations: [
{
languageCode: "cs",
name: "Pěstování ostatních trvalých plodin"
},
{
languageCode: "en",
name: "Growing of other perennial crops"
}
],
children: [
{
name: "Growing of other perennial crops",
code: "01290",
order: 1012,
localizations: [
{
languageCode: "cs",
name: "Pěstování ostatních trvalých plodin"
},
{