Skip to content

Commit cc5cb51

Browse files
authored
Merge pull request #1 from Leapsight/feature/write-over-null
write actions over null/undefined
2 parents afa2da6 + a3f05ef commit cc5cb51

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/maps_utils.app.src

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{application, maps_utils,
22
[{description, "An OTP application"},
3-
{vsn, "1.0.0"},
3+
{vsn, "1.1.0"},
44
{registered, []},
55
{mod, {maps_utils_app, []}},
66
{applications,

src/maps_utils.erl

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -667,6 +667,12 @@ maybe_get(Key, Map, Default) ->
667667

668668

669669
%% @private
670+
do_put_path(Keys, Value, undefined) ->
671+
do_put_path(Keys, Value, #{});
672+
673+
do_put_path(Keys, Value, null) ->
674+
do_put_path(Keys, Value, #{});
675+
670676
do_put_path([Key], Value, Map) ->
671677
maps:put(Key, Value, Map);
672678

@@ -684,6 +690,12 @@ do_put_path(Key, Value, Map) ->
684690

685691

686692
%% @private
693+
do_append_list_path(Keys, Value, undefined) ->
694+
do_append_list_path(Keys, Value, #{});
695+
696+
do_append_list_path(Keys, Value, null) ->
697+
do_append_list_path(Keys, Value, #{});
698+
687699
do_append_list_path([Key], Value, Map) ->
688700
append_list(Key, Value, Map);
689701

@@ -701,6 +713,12 @@ do_append_list_path(Key, Value, Map) ->
701713

702714

703715
%% @private
716+
do_remove_path(_, undefined) ->
717+
undefined;
718+
719+
do_remove_path(_, null) ->
720+
null;
721+
704722
do_remove_path([Key], Map) ->
705723
maps:remove(Key, Map);
706724

0 commit comments

Comments
 (0)