aws-sdk-js-v3 icon indicating copy to clipboard operation
aws-sdk-js-v3 copied to clipboard

Update utils.ts

Open christiantakle opened this issue 7 months ago • 0 comments

Remove redundant spread processKeysInObj.

Description

Avoid unnecessary memory allocation.

Testing

Filter is already returning a shallow copy of the array see:

  • https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter#return_value
  • https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax#copying_an_array

Additional context

Found this allocation when looking for a memory leak using chrome developer tools (allocation sampling). Other places in the file correctly uses obj.filter


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

christiantakle avatar Jun 30 '24 10:06 christiantakle