Sorting elements in a JavaScript array can be tricky, especially when trying to order them based on specific criteria like Ptr and Outputs values. In this case, the desired ordering is Node 0 -> Node 2 -> Node 1, where the Output of an element matches the Ptr of the next element. If you're new to JS, figuring out how to achieve this may seem daunting.
nodeObjs = [{
Node: '0',
Id: '8057358647298',
Ptr: '2454369535744',
Outputs: '2454369536096',
Type: 'SrcStream',
NodeDetails: 'MediaType=[FrameSize=8246337209332 (1920,1012),BitRate=3733169,Compressed=1,MajorType={73646976-0000-0010-8000-00AA00389B71},Stride=0,Rotation=0,FrameRate=42949672960397843 (10000000,397843),PixelAspectRatio=4294967297 (1,1),InterlacedMode=7,Subtype={34363248-0000-0010-8000-00AA00389B71}]'
},
{
Node: '1',
Id: '8057358647297',
Ptr: '2454369537680',
Outputs: '',
Type: 'Out',
NodeDetails: 'MediaType=[FrameSize=8246337209332 (1920,1012),BitRate=3733169,Compressed=0,MajorType={73646976-0000-0010-8000-00AA00389B71},Stride=1920,Rotation=0,FrameRate=42949672960397843 (10000000,397843),PixelAspectRatio=4294967297 (1,1),InterlacedMode=7,Subtype={3231564E-0000-0010-8000-00AA00389B71}]'
},
{
Node: '2',
Id: '8057358647303',
Ptr: '2454369536096',
Outputs: '2454369537680',
Type: 'Trnsfrm',
NodeDetails: 'CLSID={62CE7E72-4C71-4D20-B15D-452831A87D9D},HWMFT=0,InputType=[FrameSize=8246337209332 (1920,1012),BitRate=3733169,Compressed=1,MajorType={73646976-0000-0010-8000-00AA00389B71},Stride=0,Rotation=0,FrameRate=42949672960397843 (10000000,397843),PixelAspectRatio=4294967297 (1,1),InterlacedMode=7,Subtype={34363248-0000-0010-8000-00AA00389B71}],OutputType=[FrameSize=8246337209332 (1920,1012),BitRate=3733169,Compressed=0,MajorType={73646976-0000-0010-8000-00AA00389B71},Stride=1920,Rotation=0,FrameRate=42949672960397843 (10000000,397843),PixelAspectRatio=4294967297 (1,1),InterlacedMode=7,Subtype={3231564E-0000-0010-8000-00AA00389B71}]'
}]