How to use the asynciterator.prototype function in asynciterator

To help you get started, we’ve selected a few asynciterator examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github LinkedDataFragments / Client.js / lib / util / ExecutionLogger.js View on Github external
/*! @license MIT ©2013-2016 Miel Vander Sande, Ghent University - imec */

var Logger = require('./Logger'),
    util = require('util'),
    AsyncIterator = require('asynciterator');

var iteratorId = 0, logId = 0;

AsyncIterator.prototype._uniqueId = function () {
  if (!this.__uniqueid)
    this.__uniqueid = ++iteratorId;
  return this.__uniqueid;
};

function ExecutionLogger(name) {
  if (!(this instanceof ExecutionLogger))
    return new ExecutionLogger(name);
  Logger.call(this, name);
}
util.inherits(ExecutionLogger, Logger);

ExecutionLogger.prototype.logBinding = function (iterator, bindings, triplePattern, count) {
  if (Logger.enabled('debug'))
    this.debug(++logId, iterator._uniqueId(), bindings, triplePattern, count);
};