Comparing version 1.0.13 to 1.0.14
@@ -22,3 +22,3 @@ export = Sjablong; | ||
*/ | ||
parsePlaceholderString(markdown: any): { | ||
parsePlaceholder(markdown: any): { | ||
type: any; | ||
@@ -31,3 +31,3 @@ }; | ||
*/ | ||
getPlaceholdersFromText(text: any): any[]; | ||
getPlaceholders(text: any): any[]; | ||
/** | ||
@@ -52,3 +52,3 @@ * Replaces all placeholders in the text with data from the dataobject | ||
*/ | ||
generateJSONSchemaFromText(text: string, options: object): object; | ||
generateSchema(text: string, options: object): object; | ||
/** | ||
@@ -59,3 +59,3 @@ * Creates a JSON object with default or preview values from a JSON Schema | ||
*/ | ||
createJSONObjectFromJSONSchemaDefaults(schema: any, preview?: any): any; | ||
createObjectFromSchemaDefaults(schema: any, preview?: any): any; | ||
/** | ||
@@ -62,0 +62,0 @@ * Validates data against the schema of the template |
@@ -45,3 +45,3 @@ /* | ||
*/ | ||
parsePlaceholderString (markdown) { | ||
parsePlaceholder (markdown) { | ||
// Input validation | ||
@@ -93,3 +93,3 @@ if (!markdown || !markdown.startsWith('[[') || !markdown.endsWith(']]')) { return; } | ||
*/ | ||
getPlaceholdersFromText (text) { | ||
getPlaceholders (text) { | ||
// Input validation | ||
@@ -105,3 +105,3 @@ if (!text) { return []; } | ||
placeholders.forEach((p) => { | ||
const parsed = this.parsePlaceholderString(p); | ||
const parsed = this.parsePlaceholder(p); | ||
if (parsed) { parsedPlaceholders.push(parsed); } | ||
@@ -130,3 +130,3 @@ }) | ||
// Parse the placeholder | ||
const placeholder = this.parsePlaceholderString(p); | ||
const placeholder = this.parsePlaceholder(p); | ||
if (!placeholder) { return; } | ||
@@ -173,3 +173,3 @@ | ||
// If there are any issues with the found placeholders the parser will take care of throwing them | ||
const placeholders = this.getPlaceholdersFromText(text); | ||
const placeholders = this.getPlaceholders(text); | ||
@@ -180,7 +180,7 @@ if (!placeholders) { | ||
if(bracketMatch.length !== placeholders.length) { | ||
if (bracketMatch.length !== placeholders.length) { | ||
errors.push('There are incomplete placeholders in this template'); | ||
} | ||
this.generateJSONSchemaFromText(text); | ||
this.generateSchema(text); | ||
} | ||
@@ -211,3 +211,3 @@ | ||
*/ | ||
generateJSONSchemaFromText (text, options) { | ||
generateSchema (text, options) { | ||
// Input validation | ||
@@ -217,3 +217,3 @@ if (!text) { throw new Error('Template text was not provided'); } | ||
// Retreive all placeholders from the markdown | ||
const placeholders = this.getPlaceholdersFromText(text); | ||
const placeholders = this.getPlaceholders(text); | ||
@@ -298,3 +298,3 @@ // Generate the schema | ||
*/ | ||
createJSONObjectFromJSONSchemaDefaults (schema, preview = false) { | ||
createObjectFromSchemaDefaults (schema, preview = false) { | ||
// Input validation | ||
@@ -301,0 +301,0 @@ if (!schema) { throw new VTFKError('No schema was provided'); } |
{ | ||
"name": "sjablong", | ||
"version": "1.0.13", | ||
"version": "1.0.14", | ||
"description": "A system for replacing and/or validating replacement-fields in text", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
27111