Semi-colons: sorry, per previous, wrestling with the dissatisfying state of JS modes in emacs as a side effect of switching from CentOS 5 to Mountain Lion. I'll get my act together shortly.

indexOf: the format specifies where the image extension should be. So I could loop over all formats and break if indexOf(matches, format) === 2, but that seems less obvious to me. Did you mean you want me to avoid the:

  testValue in whitelistObject

idiom?