You should add a test case that uses arrays - I think this is going to break for values that are arrays because `flatten` is deep by default, and you want shallow.