strapi-markdown-parser
Advanced tools
Comparing version 0.0.10 to 0.0.11
25
index.js
@@ -36,15 +36,16 @@ class StrapiMarkdown { | ||
parse = data => { | ||
parse = async data => { | ||
const item = await data | ||
try { | ||
for (let key in this.model) { | ||
if (this.types.standard && this.types.standard.includes(this.model[key].type)) { | ||
const out = this.marked(data[key] || '') | ||
data[key] = out.length ? out : null | ||
} else if (this.types.inline && this.types.inline.includes(this.model[key].type)) { | ||
const out = this.marked.parseInline(data[key] || '') | ||
data[key] = out.length ? out : null | ||
if (item[key]) { | ||
if (this.types.standard.includes(this.model[key].type)) { | ||
item[key] = this.marked(item[key]) | ||
} else if (this.types.inline.includes(this.model[key].type)) { | ||
item[key] = this.marked.parseInline(item[key]) | ||
} | ||
} | ||
} | ||
return data | ||
return item | ||
} catch (err) { | ||
@@ -58,5 +59,7 @@ console.error(err) | ||
if (Array.isArray(data)) { | ||
return data.map(obj => this.parse(obj)) | ||
const out = Promise.all(data.map(obj => this.parse(obj))) | ||
return out | ||
} else { | ||
return this.parse(data) | ||
const out = this.parse(data) | ||
return out | ||
} | ||
@@ -63,0 +66,0 @@ } catch (err) { |
{ | ||
"name": "strapi-markdown-parser", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"description": "Strapi controller module to parse Markdown to HTML", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
132
6711