Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/tuple.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export { tuple };
// object, there's no reliable way to get the global object across all JS
// environments without using the `Function` constructor, so instead we
// use the global `Array` constructor as a shared namespace.
const root = globalKey in Array
const root = globalKey in Array && Array[globalKey]
? Array[globalKey]
: def(Array, globalKey, new UniversalWeakMap, false);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this could just be

const root = Array[globalKey] ||
  def(Array, globalKey, new UniversalWeakMap, false);

since the value of the property is always truthy once we've defined it?


Expand Down