Skip to content

Commit

Permalink
fix: use getOwnPropertySymbols only when it exists
Browse files Browse the repository at this point in the history
The getOwnPropertySymbols function was added much later than the getOwnPropertyNames function.
  • Loading branch information
aleclarson committed Jan 22, 2019
1 parent f72f69b commit d57433b
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,12 @@ export const assign =
export const ownKeys =
typeof Reflect !== "undefined" && Reflect.ownKeys
? Reflect.ownKeys
: obj =>
: typeof Object.getOwnPropertySymbols !== "undefined"
? obj =>
Object.getOwnPropertyNames(obj).concat(
Object.getOwnPropertySymbols(obj)
)
: Object.getOwnPropertyNames

export function shallowCopy(base, invokeGetters = false) {
if (Array.isArray(base)) return base.slice()
Expand Down

0 comments on commit d57433b

Please sign in to comment.