How to use the doWhilst function from async

Find comprehensive JavaScript async.doWhilst code examples handpicked from public code repositorys.

167
168
169
170
171
172
173
174
175
176
assert(hosts && hosts.length, 'No hosts to connect to');
hosts = _.shuffle(hosts);
let index = 0;
let errors = [];
let broker = null;
async.doWhilst(
  callback => {
    this.connectToBroker(hosts[index++], (error, connectedBroker) => {
      if (error) {
        logger.debug('failed to connect because of ', error);
fork icon650
star icon1
watch icon2

1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
		callback
	);
};

async.doUntil = function (iterator, test, callback) {
	return async.doWhilst(
		iterator,
		function () {
			return !test.apply(this, arguments);
		},
fork icon0
star icon0
watch icon2

+ 14 other calls in file

680
681
682
683
684
685
686
687
688
689
let bufferStream = new stream.PassThrough();
bufferStream.end(fileObject.buffer);
let semesterFolder = '1RTaX7PBV_HGzPBZbfjvtLglIoaZoluVO';
let folderID = "";
var pageToken = null;
async.doWhilst(function (callback) {
    drive.files.list({
        q: `'${semesterFolder}' in parents and mimeType = 'application/vnd.google-apps.folder'`,
        fields: 'nextPageToken, files(id, name)',
        spaces: 'drive',
fork icon0
star icon0
watch icon1

+ 3 other calls in file

808
809
810
811
812
813
814
815
816
        return !test.apply(this, arguments);
    }, iterator, callback);
};

async.doUntil = function (iterator, test, callback) {
    return async.doWhilst(iterator, function() {
        return !test.apply(this, arguments);
    }, callback);
};
fork icon0
star icon0
watch icon1

+ 21 other calls in file