Closed Mudrekh closed 2 years ago
Ok I'll write a fix. I see the example inputs and can make a test to validate it. I never use "delete" keyword and that's why I removed it from your PR.
Think it is easy
{ ...acc, [curr]: params[curr] }
Or
Object.assign(acc, { [curr]: params[curr] })
Ok I'll write a fix. I see the example inputs and can make a test to validate it. I never use "delete" keyword and that's why I removed it from your PR.
Yea, I know there are performance hits w/delete but AFAIK you really only run into that ineffciency when running deletes on large/complex objects.
I believe either option works, with the second being more 'backwards' compatible.
@patrickmichalina Do you know when you could publish these changes? I can submit a PR if that would help. I would love to get a npm version in a project I'm actively working on!
@Mudrekh as a matter of principle I just never use delete, cleaner to avoid mutations in general. I will release the change now.
Hi @patrickmichalina
An error was introduced with this commit. The parameters are incorrectly destructured, especially when they are strings. Here is an example highlighting the issue.
This is the result:
The first result is the 'expected' output when passed the params with the original 'clean' function. The second version is the TS compiled version, and the 3rd is the current TS.