Skip to content

Commit 8be29e2

Browse files
toBeTheLightyyx990803
authored andcommitted
refactor: return is better when inject has no value (#7258)
1 parent 3b7c05d commit 8be29e2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

Diff for: src/core/util/options.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -334,6 +334,7 @@ function validatePropObject (
334334
*/
335335
function normalizeInject (options: Object, vm: ?Component) {
336336
const inject = options.inject
337+
if (!inject) return
337338
const normalized = options.inject = {}
338339
if (Array.isArray(inject)) {
339340
for (let i = 0; i < inject.length; i++) {
@@ -346,7 +347,7 @@ function normalizeInject (options: Object, vm: ?Component) {
346347
? extend({ from: key }, val)
347348
: { from: val }
348349
}
349-
} else if (process.env.NODE_ENV !== 'production' && inject) {
350+
} else if (process.env.NODE_ENV !== 'production') {
350351
warn(
351352
`Invalid value for option "inject": expected an Array or an Object, ` +
352353
`but got ${toRawType(inject)}.`,

0 commit comments

Comments
 (0)