Skip to content

Commit

Permalink
improve conditionals
Browse files Browse the repository at this point in the history
  • Loading branch information
erquhart committed May 25, 2018
1 parent 78f0f50 commit 4044766
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/actions/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function validateCollection(collection) {
// Cannot set custom delimiter without explicit and proper frontmatter format declaration
throw new Error(`Please set a proper frontmatter format for collection "${name}" to use a custom delimiter. Supported frontmatter formats are yaml-frontmatter, toml-frontmatter, and json-frontmatter.`);
}
if (!!folder && !selectIdentifier(collection)) {
if (folder && !selectIdentifier(collection)) {
// Verify that folder-type collections have an identifier field for slug creation.
throw new Error(`Collection "${name}" must have a field that is a valid entry identifier. Supported fields are ${IDENTIFIER_FIELDS.join(', ')}.`);
}
Expand Down
2 changes: 1 addition & 1 deletion src/backends/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const slugFormatter = (collection, entryData, slugConfig) => {
const date = new Date();

const identifier = entryData.get(selectIdentifier(collection));
if (identifier === undefined) {
if (!identifier) {
throw new Error("Collection must have a field name that is a valid entry identifier");
}

Expand Down

0 comments on commit 4044766

Please sign in to comment.