Skip to content

Commit

Permalink
Exclude not enumerable keys of inject object
Browse files Browse the repository at this point in the history
  • Loading branch information
Elevista committed Aug 11, 2017
1 parent c628103 commit 9bc91c5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/core/instance/inject.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ export function resolveInject (inject: any, vm: Component): ?Object {
// inject is :any because flow is not smart enough to figure out cached
const result = Object.create(null)
const keys = hasSymbol
? Reflect.ownKeys(inject)
? Reflect.ownKeys(inject).filter(function (key) {
return Reflect.getOwnPropertyDescriptor(inject, key).enumerable
})
: Object.keys(inject)

for (let i = 0; i < keys.length; i++) {
Expand Down
2 changes: 1 addition & 1 deletion src/core/util/env.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ export function isNative (Ctor: any): boolean {

export const hasSymbol =
typeof Symbol !== 'undefined' && isNative(Symbol) &&
typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys)
typeof Reflect !== 'undefined' && isNative(Reflect.ownKeys) && isNative(Reflect.getOwnPropertyDescriptor)

/**
* Defer a task to execute it asynchronously.
Expand Down

0 comments on commit 9bc91c5

Please sign in to comment.