lib/web/components/dust-core.js
function getTemplate(nameOrTemplate, loadFromCache/*=true*/) {
    if(!nameOrTemplate) {
      return;
    }
    if(typeof nameOrTemplate === 'function' && nameOrTemplate.template) {
      // Sugar away CommonJS module templates
      return nameOrTemplate.template;
    }
    if(dust.isTemplateFn(nameOrTemplate)) {
      // Template functions passed directly
      return nameOrTemplate;
    }
    if(loadFromCache !== false) {
      // Try loading a template with this name from cache
      return dust.cache[nameOrTemplate];
    }
  }
function getTemplate(nameOrTemplate, loadFromCache/*=true*/) {
    if(!nameOrTemplate) {
      return;
    }
    if(typeof nameOrTemplate === 'function' && nameOrTemplate.template) {
      // Sugar away CommonJS module templates
      return nameOrTemplate.template;
    }
    if(dust.isTemplateFn(nameOrTemplate)) {
      // Template functions passed directly
      return nameOrTemplate;
    }
    if(loadFromCache !== false) {
      // Try loading a template with this name from cache
      return dust.cache[nameOrTemplate];
    }
  }
function getTemplate ( nameOrTemplate , loadFromCache /*=true*/ ) { if ( ! nameOrTemplate ) { return ; } if ( typeof nameOrTemplate === 'function' && nameOrTemplate . template ) { // Sugar away CommonJS module templates return nameOrTemplate . template ; } if ( dust . isTemplateFn ( nameOrTemplate ) ) { // Template functions passed directly return nameOrTemplate ; } if ( loadFromCache !== false ) { // Try loading a template with this name from cache return dust . cache [ nameOrTemplate ] ; } }
Extracts a template function (body_0) from whatever is passed.
@param nameOrTemplate {*} Could be:
- the name of a template to load from cache
- a CommonJS-compiled template (a function with a `template` property)
- a template function
@param loadFromCache {Boolean} if false, don't look in the cache
@return {Function} a template function, if found
Extracts a template function ( body_0 ) from whatever is passed .