From 8be29e2f193c9503aed2e76e3775e157dbebb576 Mon Sep 17 00:00:00 2001 From: toBeTheLight Date: Sat, 16 Dec 2017 14:47:44 -0600 Subject: [PATCH] refactor: return is better when inject has no value (#7258) --- src/core/util/options.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/core/util/options.js b/src/core/util/options.js index 07d9cfc0..ff58cd30 100644 --- a/src/core/util/options.js +++ b/src/core/util/options.js @@ -334,6 +334,7 @@ function validatePropObject ( */ function normalizeInject (options: Object, vm: ?Component) { const inject = options.inject + if (!inject) return const normalized = options.inject = {} if (Array.isArray(inject)) { for (let i = 0; i < inject.length; i++) { @@ -346,7 +347,7 @@ function normalizeInject (options: Object, vm: ?Component) { ? extend({ from: key }, val) : { from: val } } - } else if (process.env.NODE_ENV !== 'production' && inject) { + } else if (process.env.NODE_ENV !== 'production') { warn( `Invalid value for option "inject": expected an Array or an Object, ` + `but got ${toRawType(inject)}.`,