Skip to content

Conversation

fregante
Copy link
Contributor

@fregante fregante commented Apr 7, 2021

Will help fix #251

Follows and is based on #252

Untested but it looks equivalent

Comment on lines 38 to 40
tree[owner] = Object.assign(tree[owner] || {}, {
[repository]: Boolean(stored && stored[owner] && stored[owner][repository])
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

.reduce brought us to do unspeakable things

Suggested change
tree[owner] = Object.assign(tree[owner] || {}, {
[repository]: Boolean(stored && stored[owner] && stored[owner][repository])
});
tree[owner] = tree[owner] || {};
tree[owner][repository] = Boolean(stored && stored[owner] && stored[owner][repository]);

Or this?

Suggested change
tree[owner] = Object.assign(tree[owner] || {}, {
[repository]: Boolean(stored && stored[owner] && stored[owner][repository])
});
tree[owner] = tree[owner] || {};
tree[owner][repository] = Boolean(stored?.[owner]?.[repository]);

Reading the code, however, it seems that this code is wrong in many parts. stored is never null nor empty since it gets the default options.

Copy link
Owner

Choose a reason for hiding this comment

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

The latter

Copy link
Contributor Author

@fregante fregante Apr 7, 2021

Choose a reason for hiding this comment

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

It'll have to be done separately because this branch is on Node 11

@fregante fregante mentioned this pull request Apr 7, 2021
@fregante fregante changed the title Lint Lint and update dependencies Apr 7, 2021
@fregante fregante marked this pull request as ready for review April 7, 2021 04:53
@sindresorhus sindresorhus merged commit 94193c8 into sindresorhus:main Apr 7, 2021
@fregante fregante deleted the lint branch April 7, 2021 05:33
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.

2 participants