Minor optimization

Move loop invariant code.
Having in mind `Array.isArray` returns boolean, your suggestion would make `excludes` equal to `true` in case excludes was an array up to that line, which is not what we want, is it? :)