(template, name = JSONEditor.defaults.template)
| 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 */ |
no test coverage detected