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

Check for empty tags #557

Merged
merged 3 commits into from
Jun 12, 2019
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
9 changes: 7 additions & 2 deletions src/TemplateData.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,8 +338,13 @@ class TemplateData {
}

static cleanupData(data) {
if ("tags" in data && typeof data.tags === "string") {
data.tags = data.tags ? [data.tags] : [];
if ("tags" in data){
if (typeof data.tags === "string"){
data.tags = data.tags ? [data.tags] : [];
}
if (data.tags === null){
Copy link
Contributor

Choose a reason for hiding this comment

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

This should be an else if since the conditions are mutually exclusive. When typeof data.tags === "string", the second condition is evaluated again even though it cannot be true.

data.tags = []
}
}

return data;
Expand Down