Is it necessary to check again for `isUndefined`? Wouldn't just `patterns[i] && patterns[i].source` be enough?