Permalink
Browse files

Replace null with empty string

  • Loading branch information...
1 parent ff6a8d7 commit 148fdbcacabe6224d8d23d7805ed0862d64052b2 @michaelnisi committed Mar 30, 2013
Showing with 11 additions and 11 deletions.
  1. +6 −6 lib/getItem.js
  2. +5 −5 test/getItem.js
View
@@ -21,8 +21,8 @@ module.exports = function (props, filename, str) {
, paths = props.paths
, templates = props.templates
, views = props.views
-
- if (!header) {
+
+ if (!header) {
throw(new Error('Header required in ' + filename))
}
@@ -39,14 +39,14 @@ module.exports = function (props, filename, str) {
header.title = header.title || null
header.date = header.date ? new Date(header.date) : new Date()
- header.path = header.path
+ header.path = header.path
|| path.dirname(filename).split(paths.posts)[1]
- || null
+ || ''
item.header = header
item.body = body
item.paths = paths
-
+
item.title = header.title
item.name = header.name
item.date = header.date
@@ -57,6 +57,6 @@ module.exports = function (props, filename, str) {
item.link = path.join(header.path, header.name)
item.bake = views[header.template]
item.template = templates[header.template]
-
+
return item
}
View
@@ -4,9 +4,9 @@ var test = require('tap').test
, path = require('path')
, readFileSync = require('fs').readFileSync
, config = require('./config.js')
- , target = config.target
+ , target = config.target
, props = config.props
- , paths = props.paths
+ , paths = props.paths
test('read', function (t) {
var filename = path.join(paths.data, 'index.md')
@@ -18,9 +18,9 @@ test('read', function (t) {
t.equal(header.name, 'index.html')
t.equal(header.title, null)
t.ok(header.date instanceof Date, 'should be instance of Date')
- t.equal(header.path, null)
-
- t.ok(item.body.length, 'should have body')
+ t.equal(header.path, '')
+
+ t.ok(item.body.length, 'should have body')
t.equal(item.title, null)
t.equal(item.name, 'index.html')
t.same(item.date, header.date)

0 comments on commit 148fdbc

Please sign in to comment.