get result by merge data with template
@param data
@param callback function called
@return {String}
495588
function (data, callback) {
            var html = '';
            var self = this;
            var fn = self.fn;
            callback = callback || function (error, ret) {
                html = ret;
            };
            var name = self.config.name;
            if (!name && fn.TPL_NAME) {
                name = fn.TPL_NAME;
            }
            var scope = new Scope(data), buffer = new LinkedBuffer(callback).head;
            renderTpl({
                name: name,
                fn: fn,
                session: {},
                root: self
            }, scope, buffer);
            return html;
        }
429280
function (callback) {
    var data = JSON.stringify(this);
    this.cloneWithoutData(function(clone) {
      clone.loadFromJSON(data, function() {
        callback && callback(clone);
      });
    });
  }
521245
function context(data, callback) {
    this.__data     = data;
    this.__callback = callback;
    this.__result   = [''];
    this.__current  = 0;
    this.__waiting  = 1;
    this.__contents = -1;
}
1190534
function join(handler, data, item, type, callback) {

  const schema = item.schema;
  if (!data || !schema) {
    return callback();
  }

  // 已经获取的内容（不再重复获取，检索时剔除这些内容）
  const selected = data.options ? _.keys(data.options[schema]) : [];

  // 最终结果保存在options里
  data.options = data.options || {};

  // 指定检索条件
  let filter = {free: {}, select: item.fields}, storeKey;
  Object.keys(item.conditions).forEach(key => {

    let dataKey = item.conditions[key];

    // $符号开头的是变量，需要在data里取值作为真正的检索条件值
    if (dataKey[0] === '$') {
      let val = helper.get((type === 4) ? data.items : data, dataKey.substr(1)); // 列表类型（type=4）时，在items里取值
      val = _.isArray(val) ? val : [val];
      val = _.union(_.compact(_.difference(_.flatten(val), selected)));     // 去除已经获取的，空的，重复的

      if (!_.isEmpty(val)) {
        filter.free[key] = {$in: val};
      }

      // 确定保存Option数据的key，找出与当前数据字段相同的条件的名称
      if (dataKey.substr(1) === item.key) {
        storeKey = key;
      }
    } else {
      filter.free[key] = dataKey;
    }
  });

  // 没有条件，不检索options项，防止检索所有的值出来
  if (_.isEmpty(filter.free)) {
    return callback();
  }

  // 找到新的board
  const board = cache.get(CONST.SYSTEM_DB_BOARD).find(item => item.schema === schema && item.action === 'list')
    , script  = buildScript(board, filter, handler.timezone);

  // 查询
  new ctrl(handler.copy({script: script, condition: filter.condition}), schema).list((err, result) => {
    if (err) {
      return callback(err);
    }
    result.items.forEach(item => {
      data.options[schema] = data.options[schema] || {};
      data.options[schema][item[storeKey] || item._id] = item;
    });

    callback();
  });
}
832240
function parseURL2ChartData(url, callback) {
  const success = code => {
    const chartData = parseDSV2ChartData(code);

    callback(chartData);
  };
  const fail = () => callback(null);

  $.get(url).done(success).fail(fail);
}
751656
function templateFunc(str, data) {

  const func = function(obj) {
    return str.replace(/<%=([^%]*)%>/g, match => {
      //match t("...")
      let s = match.match(/t\s*\(([^)]+)\)/g);
      //replace with translation
      if (s.length) {
        s = obj.t(s[0].match(/"([^"]+)"/g)[0].split('"').join(""));
      }
      //use object[name]
      else {
        s = match.match(/([a-z\-A-Z]+([a-z\-A-Z0-9]?[a-zA-Z0-9]?)?)/g)[0];
        s = obj[s] || s;
      }
      return s;
    });
  };
  // Figure out if we're getting a template, or if we need to
  // load the template - and be sure to cache the result.
  const fn = !/<[a-z][\s\S]*>/i.test(str) ? templates[str] = templates[str] || templateFunc(globals.templates[str]) : func;

  // Provide some basic currying to the user
  return data ? fn(data) : fn;
}
1311820
function mergeData(sourceData) {
          var map = {};
          $.each(data, function(i, datum) {
            map[datum.value] = datum;
          });
          $.each(sourceData, function(i, sourceDatum) {
            $.extend(sourceDatum, map[sourceDatum.value]);
          });
          return sourceData;
        }
835592
function(callback) {
                    var data = this.__get();
                    for (var prop in data) {
                        if (data.hasOwnProperty(prop)) {
                            callback(data[prop], prop);
                        }
                    }
                }
524445
function( callback ){
      var tm = this;

      setTimeout(function () {
        var returnValue;

        //check for template existance.
        if (tm.template) {
          tm._tokenize();
          returnValue = tm._tokens;

          // execute callback.
          if (callback) {
            callback( returnValue );
          }
        } else {
          throw "ParseError: No template to parse.";
        }
      }, 0);
    }
974936
public void completeCallback(final Callback callback, final String error, final JsonNode result) {
        ObjectNode req = makeRequest("complete");
        req.put("cbid", callback.getCbid());
        req.put("err", error);
        req.set("result", result);

        this.runtime.requestResponse(req);
    }
1115314
function (template, data) {
            var p;
            for (p in data) {
                if (data.hasOwnProperty(p)) {
                    template = template.replace(new RegExp('\\{\\{' + p + '\\}\\}', 'g'), data[p]);
                }
            }
            return template;
        }
31366
function ( callback ) {
					self.api.call( _.extend( params, continueParams ), function ( err, data, next ) {
						if ( err ) {
							callback( err );
						} else {
							// append batch data
							const batchData = ( typeof key === 'function' ) ? key( data ) : data[ key ];

							res = res.concat( batchData );

							// more pages?
							continueParams = next;
							callback( next ? null : true );
						}
					} );
				}
16865
function(view, data, helpers, callback) {
                    return can.view.renderAs("string", view, data, helpers, callback);
                }
222861
public function mergeData(array $data)
	{
		$args = func_get_args();
		while (list(,$v) = each($args)) {
			if (is_array($v)) {
				$this->data = array_merge($this->data, $v);
			}
		}
	}
990678
function(data) {
            var self    = this,
                render  = null,
                el      = null,
                temp    = null,
                output  = '';

            self.callActions('beforeRender', arguments);

            render = self.callFilters('renderRender', self.mixer.config.render.target, arguments);

            if (typeof render !== 'function') {
                throw new TypeError(mixitup.messages.errorDatasetRendererNotSet());
            }

            output = render(data);

            if (output && typeof output === 'object' && h.isElement(output)) {
                el = output;
            } else if (typeof output === 'string') {
                temp = document.createElement('div');
                temp.innerHTML = output;

                el = temp.firstElementChild;
            }

            return self.callFilters('elRender', el, arguments);
        }
1236877
function(callback) {
      var template = this.fetchTemplate();
      var content = template && this.templateContent();
      if (content) {
        this.convertSheetsToStyles(content);
        var styles = this.findLoadableStyles(content);
        if (styles.length) {
          var templateUrl = template.ownerDocument.baseURI;
          return Polymer.styleResolver.loadStyles(styles, templateUrl, callback);
        }
      }
      if (callback) {
        callback();
      }
    }
4524
function getImageData(array, callback)
    {
    "use strict";    
    array.map( doSomething);   
    // this is not fully satisfying - I collect the promises and then do the writeFile via timeout
    setTimeout(function(){
        "use strict";  
        Q.all(promises)
            .then(function (first) {
                writeFile();
            }, function (error) {
            // All of the promises were rejected.
        });

    },0);

    }