Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added value not false check when assigning root for package #3

Merged
merged 2 commits into from Aug 4, 2018

Conversation

ptMuta
Copy link
Contributor

@ptMuta ptMuta commented Aug 3, 2018

Fixes #2

src/tuple.js Outdated
@@ -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?

@ptMuta
Copy link
Contributor Author

ptMuta commented Aug 3, 2018 via email

@benjamn benjamn merged commit e5fb36c into benjamn:master Aug 4, 2018
@dy dy mentioned this pull request Sep 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants