How to use the filterLimit function from async

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

13
14
15
16
17
18
19
20
21
22
var url = urls.crandb + '/-/sysreqs';
got(url, function(err, data) {
  if (err) { return console.log(err); }
  var sys = JSON.parse(data);
  var keys = Object.keys(sys);
  async.filterLimit(
    keys,
    10,
    function(item, callback) {
      if (item.indexOf('-') > -1) { return callback(false); }
fork icon3
star icon3
watch icon3

165
166
167
168
169
170
171
172
173
174
    })
  })
}  
async filterLimit(coll, limit, iteratee) {    
  return new Promise(async (resolve, reject) => { 
    async.filterLimit(coll, limit, iteratee, (err, res) => {
      if (err) { 
        reject(err)
      } else {
        resolve(res)
fork icon1
star icon0
watch icon1

+ 21 other calls in file

50
51
52
53
54
55
56
57
58
59
    accept.forEach(fill.bind(null, folder, req.method.toLowerCase()));
    accept.forEach(fill.bind(null, folder, 'any'));
});

var result = null;
async.filterLimit(files, 1, fs.exists, function(results) {
    if (results.length) {
        fs.readFile(results[0], function(error, data) {
            result = {
                content: data.toString(),
fork icon0
star icon3
watch icon4

31
32
33
34
35
36
37
38
39
40
      localizedPath: path.join(basePath, page.relativePath),
      languageCode: language.code
    }))
  })
  .flat()
localizedPaths = await filterLimit(
  localizedPaths,
  FILE_READ_LIMIT,
  async ({ localizedPath }) => Page.exists(localizedPath)
)
fork icon0
star icon2
watch icon1

19
20
21
22
23
24
25
26
27
28
    } catch (err) {
        console.error(err);
    }
});

// let badVideos = await async.filterLimit(videosWithUpload, 2, async (video) => {
//     console.log(video.id);
//     try {
//         let response = await request({ method: 'HEAD', uri: video.originalUpload.S3Url() })
//         return response['content-length'] === '0'
fork icon0
star icon0
watch icon2