Skip to content

Commit

Permalink
Make the allowFields check use undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardoboucas committed Mar 17, 2018
1 parent 87f3115 commit 28caae6
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<img src="logo.png" width="300">

# Staticman [![coverage](https://img.shields.io/badge/coverage-54%25-red.svg?style=flat?style=flat-square)](https://github.com/eduardoboucas/staticman) [![Build Status](https://travis-ci.org/eduardoboucas/staticman.svg?branch=master)](https://travis-ci.org/eduardoboucas/staticman) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)
# Staticman [![coverage](https://img.shields.io/badge/coverage-53%25-red.svg?style=flat](https://github.com/eduardoboucas/staticman) [![Build Status](https://travis-ci.org/eduardoboucas/staticman.svg?branch=master)](https://travis-ci.org/eduardoboucas/staticman) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)

> Static sites with superpowers
Expand Down
2 changes: 1 addition & 1 deletion lib/Staticman.js
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ Staticman.prototype._validateFields = function (fields) {

Object.keys(fields).forEach(field => {
// Check for any invalid fields
if ((this.siteConfig.get('allowedFields').indexOf(field) === -1) && (fields[field] !== '')) {
if ((this.siteConfig.get('allowedFields').indexOf(field) === -1) && (fields[field] !== undefined)) {
invalidFields.push(field)
}

Expand Down
2 changes: 1 addition & 1 deletion test/utils/coverage.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ coberturaBadger(opts, function parsingResults(err, badgeStatus) {
// open the README.md and add this url
fs.readFile(readme, {encoding: 'utf-8'}, function (err, body) {
body = body.replace(/(!\[coverage\]\()(.+?)(\))/g, function(whole, a, b, c) {
return a + badgeUrl.replace('%','%25') + '?style=flat-square' + c
return a + badgeUrl
})

fs.writeFile(readme, body, {encoding: 'utf-8'}, function (err) {
Expand Down
2 changes: 1 addition & 1 deletion test/utils/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 28caae6

Please sign in to comment.