r/javascript • • Mar 02 '19

Useful javascript one-liners.

https://medium.com/@smellycode/js-one-liners-8bc0a6af2345?source=friends_link&sk=a9295a05aef9e514e137fca7eeb89cd1
344 Upvotes

96 comments sorted by

View all comments

2

u/Pavlo100 Mar 02 '19

removeDuplicates only removes duplicates if they are primitives. if you use an object as parameter then it will fail

2

u/LookingForAPunTime Mar 02 '19

If you care about strict object equality, perhaps you should use an immutability library such as Immutable.js

It won’t completely prevent duplicates instances, but it can greatly reduce the need for deep object equality checks.