|
|
@ -32,7 +32,7 @@ cut(Term, Depth) when is_map(Term) -> |
|
|
|
cut(Term, Depth) when is_tuple(Term), Depth =:= ?MaxDepth -> |
|
|
|
{'$truncated'}; |
|
|
|
cut(Term, Depth) when is_tuple(Term) -> |
|
|
|
list_to_tuple(cutList(tuple_to_list(Term), Depth, 0, ?MaxTupleSize, 0)); |
|
|
|
list_to_tuple(cutList(tuple_to_list(Term), Depth, 0, ?MaxTupleSize, 0, [])); |
|
|
|
cut(Term, _) -> |
|
|
|
Term. |
|
|
|
|
|
|
@ -46,8 +46,8 @@ cutList([Term | Tail], Depth, Len, MaxLen, NumStructs, Acc) -> |
|
|
|
%% if List was a cons, Tail can be anything |
|
|
|
cutList(Tail, Depth, Len + 1, MaxLen, NumStructs + isStruct(Term), [cut(Term, Depth + 1) | Acc]) |
|
|
|
end; |
|
|
|
cutList(Term, Depth, _, _, _, Acc) -> %% if List was a cons |
|
|
|
cut(Term, Depth + 1). |
|
|
|
cutList(Term, Depth, _, _, _, Acc) -> %% if List was a cons [[[a,a,a|b],1,2,3]|bbbb] |
|
|
|
lists:reverse(Acc) ++ cut(Term, Depth + 1). |
|
|
|
|
|
|
|
cutMap([], _, _) -> |
|
|
|
[]; |
|
|
|