Generally I follow the same pattern whenever I do ...
# suitescript
e
Generally I follow the same pattern whenever I do a Search or read data from a Record, where I take the SuiteScript Object(s) and translate them into plain JS Objects, in the format I want them, then I do my processing on the plain JS Objects, and then translate the plain Objects back to SuiteScript Objects if necessary