MCPcopy Index your code
hub / github.com/json-editor/json-editor / compileTemplate

Method compileTemplate

src/core.js:267–285  ·  view source on GitHub ↗
(template, name = JSONEditor.defaults.template)

Source from the content-addressed store, hash-verified

265 }
266
267 compileTemplate (template, name = JSONEditor.defaults.template) {
268 let engine
269
270 /* Specifying a preset engine */
271 if (typeof name === 'string') {
272 if (!JSONEditor.defaults.templates[name]) throw new Error(`Unknown template engine ${name}`)
273 engine = JSONEditor.defaults.templates[name]()
274
275 if (!engine) throw new Error(`Template engine ${name} missing required library.`)
276 } else {
277 /* Specifying a custom engine */
278 engine = name
279 }
280
281 if (!engine) throw new Error('No template engine set')
282 if (!engine.compile) throw new Error('Invalid template engine set')
283
284 return engine.compile(template)
285 }
286
287 _data (el, key, value) {
288 /* Setting data */

Callers 7

setupWatchListenersMethod · 0.80
getLinkMethod · 0.80
_expandSchemaLinkMethod · 0.80
buildMethod · 0.80
preBuildMethod · 0.80
preBuildMethod · 0.80
buildMethod · 0.80

Calls 1

compileMethod · 0.80

Tested by

no test coverage detected