Skip to content

Commit d57433b

Browse files
committed
fix: use getOwnPropertySymbols only when it exists
The getOwnPropertySymbols function was added much later than the getOwnPropertyNames function.
1 parent f72f69b commit d57433b

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/common.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,12 @@ export const assign =
4444
export const ownKeys =
4545
typeof Reflect !== "undefined" && Reflect.ownKeys
4646
? Reflect.ownKeys
47-
: obj =>
47+
: typeof Object.getOwnPropertySymbols !== "undefined"
48+
? obj =>
4849
Object.getOwnPropertyNames(obj).concat(
4950
Object.getOwnPropertySymbols(obj)
5051
)
52+
: Object.getOwnPropertyNames
5153

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

0 commit comments

Comments
 (0)