<commit_before>var assert = require ('assert');
var promise = require("./promise");
var ZooKeeper = require ("./zookeeper");
var util = require('util');

exports = module.exports = ZooKeeperPromise;
exports.ZK = ZooKeeperPromise; // backwards compatibility

function ZooKeeperPromise() {
  var self = this;

  ZooKeeper.apply(this, arguments);

  return self;
}
util.inherits(ZooKeeperPromise, ZooKeeper);

ZooKeeperPromise.prototype.on_connected = function on_connected() {
  var self = this;
  var deferred = promise.defer();
  self.on ('connect', function () {
    deferred.resolve (self);
  });
  return deferred.promise;
};



function convertAsync(fn){
  return function() {
    var self = this;
    var deferred = promise.defer();<commit_msg>Fixed the crash on re-connection in ZooKeeperPromise.on_connected() Ref: https://github.com/yfinkelstein/node-zookeeper/issues/50<commit_after>var assert = require ('assert');
var promise = require("./promise");
var ZooKeeper = require ("./zookeeper");
var util = require('util');

exports = module.exports = ZooKeeperPromise;
exports.ZK = ZooKeeperPromise; // backwards compatibility

function ZooKeeperPromise() {
  var self = this;

  ZooKeeper.apply(this, arguments);

  return self;
}
util.inherits(ZooKeeperPromise, ZooKeeper);

ZooKeeperPromise.prototype.on_connected = function on_connected() {
  var self = this;
  var deferred = promise.defer();
  self.once ('connect', function () {
    deferred.resolve (self);
  });
  return deferred.promise;
};



function convertAsync(fn){
  return function() {
    var self = this;
    var deferred = promise.defer();
{'fraction_non_alphanumeric': 0.1349009900990099, 'fraction_numerical': 0.0012376237623762376, 'mean_word_length': 4.634146341463414, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3662565', 'n_tokens_mistral': 533, 'n_tokens_neox': 489, 'n_words': 123}