This should just be `typeof modules[i] === 'object'`