Есть массив данных типа:
const input = [
[0, [0, 1], 0, "Text"],
[0, [], 1, "Em-and-Bold"],
[0, [], 1, "Bold"],
]
И на выходе нужен вот такой формат:
const expected = [
[0, 0,
[0, 1, [
[0, null, "Text"],
[0, null, "Em-and-Bold"]
]],
[0, null, "Bold"]
],
]