Don't mutate function inputs


Never mutate (e.g. update collection field) of the API input parameter and in general try to make most methods side-effect free. E.g.:

function addToFileList(job, chunk) {
   return job;

is a very dangerous code as caller will not know that you have actually mutated fileList field in the input of this method

1 Like