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

Fix checking of type array #185

Closed
wants to merge 1 commit into from
Closed

Fix checking of type array #185

wants to merge 1 commit into from

Conversation

foxB612
Copy link

@foxB612 foxB612 commented May 13, 2022

The condition will always be true since js arrays are actually objects.

@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling fe4d291 on foxB612:fix-arr into cd72fad on hexojs:master.

@@ -43,7 +43,7 @@ if (Array.isArray(type)) {
}
break;
case 2:
if (type !== ['atom', 'rss2'] && type !== ['rss2', 'atom']) {
if (!(type[0] === 'atom' && type[1] === 'rss2') && !(type[0] === 'rss2' && type[1] === 'atom')) {
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
if (!(type[0] === 'atom' && type[1] === 'rss2') && !(type[0] === 'rss2' && type[1] === 'atom')) {
if (!type.every(t => ['atom', 'rss2'].includes(t))) {

Copy link
Author

Choose a reason for hiding this comment

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

Shouldn't the two types be different? Because paths can be generated from types which might result in duplicate paths.

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

3 participants