fix: Switch converted to Object Literal (#940)
* updating a switch into object literal and fixed a couple linter errors * added a comment about weird formatting * style: use lodash get * fix: pass eslint + puglint + jest
This commit is contained in:
committed by
Nicolas Giard
parent
2142b5f674
commit
0f9ddf1e5d
@@ -1,7 +1,5 @@
|
||||
const crypto = require('crypto')
|
||||
|
||||
/* global WIKI */
|
||||
|
||||
module.exports = {
|
||||
/**
|
||||
* Generate unique hash from page
|
||||
|
@@ -66,14 +66,11 @@ module.exports = {
|
||||
['date', page.updatedAt],
|
||||
['tags', '']
|
||||
]
|
||||
switch (page.contentType) {
|
||||
case 'markdown':
|
||||
return '---\n' + meta.map(mt => `${mt[0]}: ${mt[1]}`).join('\n') + '\n---\n\n' + page.content
|
||||
case 'html':
|
||||
return '<!--\n' + meta.map(mt => `${mt[0]}: ${mt[1]}`).join('\n') + '\n-->\n\n' + page.content
|
||||
default:
|
||||
return page.content
|
||||
const inject = {
|
||||
'markdown': '---\n' + meta.map(mt => `${mt[0]}: ${mt[1]}`).join('\n') + '\n---\n\n' + page.content,
|
||||
'html': '<!--\n' + meta.map(mt => `${mt[0]}: ${mt[1]}`).join('\n') + '\n-->\n\n' + page.content
|
||||
}
|
||||
return _.get(inject, page.contentType, page.content)
|
||||
},
|
||||
/**
|
||||
* Check if path is a reserved path
|
||||
|
Reference in New Issue
Block a user