-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Hi There,
Thank you for the lib, I was just about to roll my own and you saved me a bunch of time 👍
I think there is an error though and that is that deep_remove will remove the last known key if the full path does not exist.
Tried the following three examples:
Msg = #{k => #{k1 => #{k2 => value,k3 => #{k4 => value2},k4 => 333}}}.
mapz:deep_remove([k,k1,k2,k3,k4,k5], Msg).
#{k => #{k1 => #{k3 => #{k4 => value2},k4 => 333}}}
Here I want to remove a non-existent k5 but because k2 doesn't contain a k3, it's removed instead!
The actual example I tried was this:
%% same Msg as above
mapz:deep_remove([k,k1,k3,k4,k5], Msg).
#{k => #{k1 => #{k2 => value,k3 => #{},k4 => 333}}}
k3 contains a k4 but as k.k1.k3.k4 is not a map but a value (and does not contain a k5), k4 is removed instead of doing nothing - which I would assume to be the case for a non-existent path?
And the third example:
mapz:deep_remove([k,k33,k3,k4,k5], Msg).
${}
I can wipe my entire map by using a incorrect second key! :sadface:
Am I missing something?
Metadata
Metadata
Assignees
Labels
No labels