When accomplishing simple object iteration, should I write my code like this:
@OntologyEditFunction()
@Edits(sampleObject)
@Function()
public async marksampleObject(
ObjSet: ObjectSet<sampleObject>
): Promise<void>{
const objects = await sampleObject.allAsync();
objects.forEach( (obj) => {
obj.prop = true;
})
}
or
@OntologyEditFunction()
@Edits(sampleObject)
@Function()
public async marksampleObject(
ObjSet: ObjectSet<sampleObject>
): Promise<void>{
const objects = sampleObject.all();
objects.map( (obj) => {
obj.prop = true;
})
}
Which is cleaner/faster?