I don't think the usage here of map is correct, as one of the elements is going to be mapped to nothing, and as a result the array will end up having one element as undefined which can cause later errors in the code. I would prefer we filter out the type meta element and then map the array. 

The same applies to pref (line 285), which will avoid an additional splice operation