JS: reducer output only if map size > 0