I need assistance creating a function that will convert a given string into the specified output format shown below:
// Input
const optionRule = '{1069} AND ({1070} OR {1071} OR {1072}) AND {1244} AND ({1245} OR {1339})';
// Output Example
/* const output = {
and: [
1069,
{ or: [1070, 1071, 1072] },
1244,
{ or: [1245, 1339] },
]
}; */
let result = 'result'
console.log('result:', result);
Seeking guidance on how to achieve this task. Any help would be greatly appreciated.