Open mastef opened 8 years ago
Thanks for the conribution. This is a difficult one since it is a breaking change.
Happy to accept with the following change. Add a fuction that takes the depth parameter and the existing function can stay the same. The existing function should just be a passthrough to the one with a depth parameter. We'd need these for both explodeMap and explodeList
e.g.
func explodeMap(l interface{}, parent string, delimiter string) (map[string]interface{}, error) {
explodeMapWithDepth(i, parent, delimiter, -1)
}
and
func explodeMapWithDepth(l interface{}, parent string, delimiter string, depth int) (map[string]interface{}, error) {
...
...
}
Also, if you could squash your commits before submitting the PR, I'd really appreciate it since this is a single change.
We needed an option to require a maximum depth of nesting. The default behaviour still works with specifying a negative value
-1
, no nesting is done with0
and depth can be specified with any values above.I don't know if you still maintain the project, but if this is interesting for you please feel free to merge, then I'd remove our fork. Otherwise feel free to ignore :-)
Added also some further test cases to test for the depth and a different merge character.
Note : This is a breaking change, since a parameter was added.
Cheers!