Showing
138 changed files
with
4583 additions
and
37 deletions
... | @@ -3,8 +3,9 @@ | ... | @@ -3,8 +3,9 @@ |
3 | var express = require('express'); | 3 | var express = require('express'); |
4 | var http = require('http'); | 4 | var http = require('http'); |
5 | var bodyParser = require('body-parser'); | 5 | var bodyParser = require('body-parser'); |
6 | -var singer = require('./content') | ||
7 | var app = express(); // express 객체 저장 | 6 | var app = express(); // express 객체 저장 |
7 | +var webcrawl = require('./crawling/Reol'); | ||
8 | +var async = require('async'); | ||
8 | 9 | ||
9 | //body-parser 미들웨어 사용 | 10 | //body-parser 미들웨어 사용 |
10 | app.use(bodyParser.urlencoded({extended: false})); | 11 | app.use(bodyParser.urlencoded({extended: false})); |
... | @@ -19,50 +20,137 @@ app.get('/keyboard', function(req,res){ | ... | @@ -19,50 +20,137 @@ app.get('/keyboard', function(req,res){ |
19 | 20 | ||
20 | }); | 21 | }); |
21 | 22 | ||
22 | -//9090포트로 서버 접속 | 23 | +//8080포트로 서버 접속 |
23 | http.createServer(app).listen(8080, () => { | 24 | http.createServer(app).listen(8080, () => { |
24 | console.log('Server running..'); | 25 | console.log('Server running..'); |
25 | }); | 26 | }); |
26 | 27 | ||
27 | - | ||
28 | // http://서버주소/message | 28 | // http://서버주소/message |
29 | app.post('/message', function(req,res){ | 29 | app.post('/message', function(req,res){ |
30 | //유저가 입력한 데이터 | 30 | //유저가 입력한 데이터 |
31 | var msg = req.body.content; | 31 | var msg = req.body.content; |
32 | console.log('전달받은 메시지 : ' + msg); | 32 | console.log('전달받은 메시지 : ' + msg); |
33 | - | ||
34 | var send = {}; | 33 | var send = {}; |
35 | - | 34 | + var task = [ |
35 | + function(callback){ | ||
36 | switch(msg){ | 36 | switch(msg){ |
37 | - case '일본' : | 37 | + case 'Reol-Discography' : |
38 | + webcrawl.crawl_Reol('https://namu.wiki/w/%EB%A0%88%EC%98%A4%EB%A3%A8/%EC%9D%8C%EB%B0%98#toc',function(Reol){ | ||
39 | + callback(null,Reol); | ||
40 | + }) | ||
41 | + break; | ||
42 | + case '米津玄師-Discography' : | ||
43 | + | ||
44 | + } | ||
45 | + | ||
46 | + }, | ||
47 | + function(discography, callback){ | ||
48 | + switch (msg) { | ||
49 | + case '일본': | ||
50 | + send = { | ||
51 | + 'message': { | ||
52 | + 'text': '등록된 가수 목록입니다.' | ||
53 | + }, | ||
54 | + keyboard: { | ||
55 | + 'type': 'buttons', | ||
56 | + 'buttons': ['Reol', '米津玄師', 'yanaginagi', 'ヨルシカ', 'ダズビ', 'Polkadot Stingray', 'Aimyong'] | ||
57 | + } | ||
58 | + | ||
59 | + }; | ||
60 | + break; | ||
61 | + | ||
62 | + case '한국': | ||
63 | + send = { | ||
64 | + 'message': { | ||
65 | + 'text': '등록된 가수 목록입니다.' | ||
66 | + }, | ||
67 | + keyboard: { | ||
68 | + 'type': 'buttons', | ||
69 | + 'buttons': ['볼빨간 사춘기', 'MOT', 'Gukkasten', 'ZICO', 'DEAN', 'IU', 'Heize'] | ||
70 | + } | ||
71 | + }; | ||
72 | + break; | ||
73 | + // ---------- contents -------------- // | ||
74 | + ///// Reol //// | ||
75 | + case 'Reol' : | ||
38 | send = { | 76 | send = { |
39 | 'message' : { | 77 | 'message' : { |
40 | - 'text' : '등록된 가수 목록입니다.' | 78 | + 'text' : '이름 : Reol(れをる) \n성별 : 여성 \n생년월일 : 1993년 11월 9일 \n혈액형 : AB형', |
79 | + 'photo' : { | ||
80 | + 'url' : 'https://www.reol.jp/images/profile/reol_Aphoto_2.png', | ||
81 | + 'width' : 1000, | ||
82 | + 'height' : 667 | ||
83 | + }, | ||
84 | + 'message_button' : { | ||
85 | + 'label' : '공식 홈페이지', | ||
86 | + 'url' : "https://www.reol.jp/" | ||
87 | + } | ||
41 | }, | 88 | }, |
42 | keyboard : { | 89 | keyboard : { |
43 | 'type' : 'buttons', | 90 | 'type' : 'buttons', |
44 | - 'buttons' : ['Reol', '米津玄師', 'yanaginagi', 'ヨルシカ', 'ダズビ', 'Polkadot Stingray', 'Aimyong'] | 91 | + 'buttons' : ['Reol-Discography'] |
45 | } | 92 | } |
46 | - | ||
47 | }; | 93 | }; |
48 | break; | 94 | break; |
49 | - case '한국' : | 95 | + case 'Reol-Discography' : |
96 | + console.log(discography); | ||
97 | + send = { | ||
98 | + 'message': { | ||
99 | + 'text': '앨범 목록입니다.' | ||
100 | + }, | ||
101 | + keyboard: { | ||
102 | + 'type': 'buttons', | ||
103 | + 'buttons': discography[0].json_album | ||
104 | + } | ||
105 | + } | ||
106 | + break; | ||
107 | + case discography[0].json_album[0]: | ||
108 | + send = { | ||
109 | + 'message' : { | ||
110 | + 'text' : discography[0].json_album[0] + '\n 발매년도 : ' + discography[0].json_year[0] + '\n 수록곡 : \n' + discography[0].json_track[0] | ||
111 | + } | ||
112 | + } | ||
113 | + /// 米津玄師 /// | ||
114 | + case '米津玄師' : | ||
50 | send = { | 115 | send = { |
51 | 'message' : { | 116 | 'message' : { |
52 | - 'text' : '등록된 가수 목록입니다.' | 117 | + 'text' : '이름 : 米津玄師(Yonezu Kenshi) \n 성별 : 남성 \n생년월일 : 1991년 3월 10일 \n혈액형 : O형', |
118 | + 'photo' : { | ||
119 | + 'url' : 'http://reissuerecords.net/rr/wp-content/uploads/flamingo_photo2.jpg', | ||
120 | + 'width' : 1000, | ||
121 | + 'height' : 667 | ||
122 | + }, | ||
123 | + 'message_button' : { | ||
124 | + 'label' : '공식 홈페이지', | ||
125 | + 'url' : "http://reissuerecords.net/" | ||
126 | + } | ||
53 | }, | 127 | }, |
54 | keyboard : { | 128 | keyboard : { |
55 | 'type' : 'buttons', | 129 | 'type' : 'buttons', |
56 | - 'buttons' : ['볼빨간 사춘기', 'MOT', 'Gukkasten', 'ZICO', 'DEAN', 'IU', 'Heize'] | 130 | + 'buttons' : ['米津玄師-Discography'] |
57 | } | 131 | } |
58 | }; | 132 | }; |
59 | break; | 133 | break; |
134 | + case '米津玄師-Discography' : | ||
135 | + send = { | ||
136 | + 'message' : { | ||
137 | + 'text' : 'Album List' | ||
138 | + }, | ||
139 | + keyboard : { | ||
140 | + 'type' : 'buttons', | ||
141 | + 'buttons' : ['Reol', '米津玄師', 'yanaginagi', 'ヨルシカ', 'ダズビ', 'Polkadot Stingray', 'Aimyong'] | ||
142 | + } | ||
143 | + | ||
144 | + }; | ||
60 | default: | 145 | default: |
61 | - send = singer.jpSinger(msg); | ||
62 | - if(send == '') | ||
63 | - send = singer.krSinger(msg); | ||
64 | break; | 146 | break; |
65 | } | 147 | } |
148 | + callback(null ,send); | ||
149 | + } | ||
150 | + ]; | ||
151 | + async.waterfall(task, function(err,result){ | ||
66 | console.log(send); | 152 | console.log(send); |
67 | res.json(send); | 153 | res.json(send); |
68 | -}) | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
154 | + }); | ||
155 | + | ||
156 | +}); | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
1 | -var webcrawl = require('./crawling/Reol') | 1 | +var webcrawl = require('./crawling/Reol'); |
2 | +var async = require('async'); | ||
2 | 3 | ||
3 | - | 4 | +function jpSinger(msg, send){ |
4 | -function jpSinger(msg, discography){ | ||
5 | var discography; | 5 | var discography; |
6 | - var send = {}; | 6 | + var task = [ |
7 | - function delay(discography){ | 7 | + function(callback){ |
8 | + webcrawl.crawl_Reol('https://namu.wiki/w/%EB%A0%88%EC%98%A4%EB%A3%A8/%EC%9D%8C%EB%B0%98#toc').then(function(Result){ | ||
9 | + callback(null,Result)}).catch(function(err){}); | ||
10 | + }, | ||
11 | + function(discography, callback){ | ||
12 | + console.log(discography); | ||
13 | + | ||
8 | switch(msg){ | 14 | switch(msg){ |
9 | case 'Reol' : | 15 | case 'Reol' : |
10 | send = { | 16 | send = { |
... | @@ -70,22 +76,20 @@ function jpSinger(msg, discography){ | ... | @@ -70,22 +76,20 @@ function jpSinger(msg, discography){ |
70 | 76 | ||
71 | }; | 77 | }; |
72 | break; | 78 | break; |
73 | - | ||
74 | default: | 79 | default: |
75 | break; | 80 | break; |
76 | } | 81 | } |
82 | + callback(null,send); | ||
77 | } | 83 | } |
78 | - webcrawl.crawl_Reol('https://namu.wiki/w/%EB%A0%88%EC%98%A4%EB%A3%A8/%EC%9D%8C%EB%B0%98#toc').then(function(Result){ | 84 | + ]; |
79 | - discography = Result; | 85 | + async.waterfall(task, function(err, result){ |
80 | - }).catch(function(err){ | 86 | + console.log(result, send); |
81 | - console.error(err); | ||
82 | - }).then(function(){ | ||
83 | - console.log(discography); | ||
84 | - delay(discography); | ||
85 | }); | 87 | }); |
88 | + | ||
86 | return send; | 89 | return send; |
87 | } | 90 | } |
88 | 91 | ||
92 | + | ||
89 | function krSinger(msg){ | 93 | function krSinger(msg){ |
90 | var send = {}; | 94 | var send = {}; |
91 | switch(msg){ | 95 | switch(msg){ | ... | ... |
1 | //Reol 나무위키 앨범 발매년도 트랙 크롤링 | 1 | //Reol 나무위키 앨범 발매년도 트랙 크롤링 |
2 | + | ||
2 | var request = require('request'); | 3 | var request = require('request'); |
3 | var cheerio = require('cheerio'); | 4 | var cheerio = require('cheerio'); |
4 | -function crawl_Reol(url){ | 5 | +function crawl_Reol(url,callback){ |
5 | - return new Promise(function(resolve, reject){ | ||
6 | request(url, function (err, res, body) { | 6 | request(url, function (err, res, body) { |
7 | const $ = cheerio.load(body); | 7 | const $ = cheerio.load(body); |
8 | 8 | ||
... | @@ -44,13 +44,87 @@ function crawl_Reol(url){ | ... | @@ -44,13 +44,87 @@ function crawl_Reol(url){ |
44 | album_track = []; | 44 | album_track = []; |
45 | } | 45 | } |
46 | }); | 46 | }); |
47 | - Reol.push({ json_album, json_year, json_track }); | 47 | + callback(Reol); |
48 | - if (Reol) { | ||
49 | - resolve(Reol); | ||
50 | - } | ||
51 | - reject(new Error("Request is failed")); | ||
52 | - }); | ||
53 | }); | 48 | }); |
54 | } | 49 | } |
55 | 50 | ||
56 | exports.crawl_Reol = crawl_Reol; | 51 | exports.crawl_Reol = crawl_Reol; |
52 | + | ||
53 | + | ||
54 | + | ||
55 | + | ||
56 | + | ||
57 | + | ||
58 | + | ||
59 | + | ||
60 | + | ||
61 | + | ||
62 | + | ||
63 | + | ||
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | ||
68 | + | ||
69 | + | ||
70 | + | ||
71 | + | ||
72 | + | ||
73 | + | ||
74 | +// promise | ||
75 | + | ||
76 | +// var request = require('request'); | ||
77 | +// var cheerio = require('cheerio'); | ||
78 | +// function crawl_Reol(url){ | ||
79 | +// return new Promise(function(resolve, reject){ | ||
80 | +// request(url, function (err, res, body) { | ||
81 | +// const $ = cheerio.load(body); | ||
82 | + | ||
83 | +// var Reol = new Array(); | ||
84 | +// var album, year | ||
85 | +// var album_track = new Array(); | ||
86 | +// var json_album = new Array(), json_year = new Array(), json_track = new Array(); | ||
87 | +// $('body > div.content-wrapper > article > div.wiki-content.clearfix > div').each(function (index, ele) { | ||
88 | +// for (var i = 1; i <= $('.toc-item').length; i++) { | ||
89 | +// album = $(this).find('#toc > div > div:nth-child(2) > span:nth-child(' + i + ')').text() //앨범 정보 가져오기 | ||
90 | +// if (album != '') { | ||
91 | +// json_album.push(album.substr(2)); | ||
92 | +// } | ||
93 | + | ||
94 | +// var index = 7 + (i * 2); //트랙, 연도 가져오기 인덱스 변수 | ||
95 | + | ||
96 | +// if (index != 25) { //규칙성이 어긋나는 부분을 예외처리를 위해 if문 | ||
97 | +// //year 가져오기 | ||
98 | +// year = $('body > div.content-wrapper > article > div.wiki-content.clearfix > div > div:nth-child(' + index + ') > div:nth-child(3) > table > tbody > tr:nth-child(1) > td:nth-child(2)').text(); | ||
99 | +// //track 가져오기 | ||
100 | +// $('body > div.content-wrapper > article > div.wiki-content.clearfix > div > div:nth-child(' + index + ') > div:nth-child(3) > table > tbody').find('tr').each(function (index, ele) { | ||
101 | +// var track = $(this).children().eq(1).text(); | ||
102 | +// if (track != '1' && track != '곡명' && track[4] != '년') | ||
103 | +// album_track.push(track) | ||
104 | +// }); | ||
105 | +// } | ||
106 | +// else { | ||
107 | +// year = $('body > div.content-wrapper > article > div.wiki-content.clearfix > div > div:nth-child(' + index + ') > div:nth-child(4) > table > tbody > tr:nth-child(1) > td:nth-child(2)').text(); | ||
108 | +// $('body > div.content-wrapper > article > div.wiki-content.clearfix > div > div:nth-child(' + index + ') > div:nth-child(4) > table > tbody').find('tr').each(function (index, ele) { | ||
109 | +// var track = $(this).children().eq(1).text(); | ||
110 | +// if (track != '1' && track != '곡명' && track[4] != '년') | ||
111 | +// album_track.push(track) | ||
112 | +// }); | ||
113 | +// } | ||
114 | +// if (year != '') { | ||
115 | +// json_year.push(year); | ||
116 | +// json_track.push(album_track); | ||
117 | +// } | ||
118 | +// album_track = []; | ||
119 | +// } | ||
120 | +// }); | ||
121 | +// Reol.push({ json_album, json_year, json_track }); | ||
122 | +// if (Reol) { | ||
123 | +// resolve(Reol); | ||
124 | +// } | ||
125 | +// reject(new Error("Request is failed")); | ||
126 | +// }); | ||
127 | +// }); | ||
128 | +// } | ||
129 | + | ||
130 | +// exports.crawl_Reol = crawl_Reol; | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
node_modules/async/CHANGELOG.md
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/LICENSE
0 → 100644
1 | +Copyright (c) 2010-2018 Caolan McMahon | ||
2 | + | ||
3 | +Permission is hereby granted, free of charge, to any person obtaining a copy | ||
4 | +of this software and associated documentation files (the "Software"), to deal | ||
5 | +in the Software without restriction, including without limitation the rights | ||
6 | +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
7 | +copies of the Software, and to permit persons to whom the Software is | ||
8 | +furnished to do so, subject to the following conditions: | ||
9 | + | ||
10 | +The above copyright notice and this permission notice shall be included in | ||
11 | +all copies or substantial portions of the Software. | ||
12 | + | ||
13 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
14 | +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
15 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
16 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
17 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
18 | +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
19 | +THE SOFTWARE. |
node_modules/async/README.md
0 → 100644
1 | +![Async Logo](https://raw.githubusercontent.com/caolan/async/master/logo/async-logo_readme.jpg) | ||
2 | + | ||
3 | +[![Build Status via Travis CI](https://travis-ci.org/caolan/async.svg?branch=master)](https://travis-ci.org/caolan/async) | ||
4 | +[![NPM version](https://img.shields.io/npm/v/async.svg)](https://www.npmjs.com/package/async) | ||
5 | +[![Coverage Status](https://coveralls.io/repos/caolan/async/badge.svg?branch=master)](https://coveralls.io/r/caolan/async?branch=master) | ||
6 | +[![Join the chat at https://gitter.im/caolan/async](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/caolan/async?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | ||
7 | +[![libhive - Open source examples](https://www.libhive.com/providers/npm/packages/async/examples/badge.svg)](https://www.libhive.com/providers/npm/packages/async) | ||
8 | +[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/async/badge?style=rounded)](https://www.jsdelivr.com/package/npm/async) | ||
9 | + | ||
10 | + | ||
11 | +Async is a utility module which provides straight-forward, powerful functions for working with [asynchronous JavaScript](http://caolan.github.io/async/global.html). Although originally designed for use with [Node.js](https://nodejs.org/) and installable via `npm install --save async`, it can also be used directly in the browser. | ||
12 | + | ||
13 | +This version of the package is optimized for the Node.js environment. If you use Async with webpack, install [`async-es`](https://www.npmjs.com/package/async-es) instead. | ||
14 | + | ||
15 | +For Documentation, visit <https://caolan.github.io/async/> | ||
16 | + | ||
17 | +*For Async v1.5.x documentation, go [HERE](https://github.com/caolan/async/blob/v1.5.2/README.md)* | ||
18 | + | ||
19 | + | ||
20 | +```javascript | ||
21 | +// for use with Node-style callbacks... | ||
22 | +var async = require("async"); | ||
23 | + | ||
24 | +var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; | ||
25 | +var configs = {}; | ||
26 | + | ||
27 | +async.forEachOf(obj, (value, key, callback) => { | ||
28 | + fs.readFile(__dirname + value, "utf8", (err, data) => { | ||
29 | + if (err) return callback(err); | ||
30 | + try { | ||
31 | + configs[key] = JSON.parse(data); | ||
32 | + } catch (e) { | ||
33 | + return callback(e); | ||
34 | + } | ||
35 | + callback(); | ||
36 | + }); | ||
37 | +}, err => { | ||
38 | + if (err) console.error(err.message); | ||
39 | + // configs is now a map of JSON data | ||
40 | + doSomethingWith(configs); | ||
41 | +}); | ||
42 | +``` | ||
43 | + | ||
44 | +```javascript | ||
45 | +var async = require("async"); | ||
46 | + | ||
47 | +// ...or ES2017 async functions | ||
48 | +async.mapLimit(urls, 5, async function(url) { | ||
49 | + const response = await fetch(url) | ||
50 | + return response.body | ||
51 | +}, (err, results) => { | ||
52 | + if (err) throw err | ||
53 | + // results is now an array of the response bodies | ||
54 | + console.log(results) | ||
55 | +}) | ||
56 | +``` |
node_modules/async/all.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _createTester = require('./internal/createTester'); | ||
8 | + | ||
9 | +var _createTester2 = _interopRequireDefault(_createTester); | ||
10 | + | ||
11 | +var _doParallel = require('./internal/doParallel'); | ||
12 | + | ||
13 | +var _doParallel2 = _interopRequireDefault(_doParallel); | ||
14 | + | ||
15 | +var _notId = require('./internal/notId'); | ||
16 | + | ||
17 | +var _notId2 = _interopRequireDefault(_notId); | ||
18 | + | ||
19 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
20 | + | ||
21 | +/** | ||
22 | + * Returns `true` if every element in `coll` satisfies an async test. If any | ||
23 | + * iteratee call returns `false`, the main `callback` is immediately called. | ||
24 | + * | ||
25 | + * @name every | ||
26 | + * @static | ||
27 | + * @memberOf module:Collections | ||
28 | + * @method | ||
29 | + * @alias all | ||
30 | + * @category Collection | ||
31 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
32 | + * @param {AsyncFunction} iteratee - An async truth test to apply to each item | ||
33 | + * in the collection in parallel. | ||
34 | + * The iteratee must complete with a boolean result value. | ||
35 | + * Invoked with (item, callback). | ||
36 | + * @param {Function} [callback] - A callback which is called after all the | ||
37 | + * `iteratee` functions have finished. Result will be either `true` or `false` | ||
38 | + * depending on the values of the async tests. Invoked with (err, result). | ||
39 | + * @example | ||
40 | + * | ||
41 | + * async.every(['file1','file2','file3'], function(filePath, callback) { | ||
42 | + * fs.access(filePath, function(err) { | ||
43 | + * callback(null, !err) | ||
44 | + * }); | ||
45 | + * }, function(err, result) { | ||
46 | + * // if result is true then every file exists | ||
47 | + * }); | ||
48 | + */ | ||
49 | +exports.default = (0, _doParallel2.default)((0, _createTester2.default)(_notId2.default, _notId2.default)); | ||
50 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/allLimit.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _createTester = require('./internal/createTester'); | ||
8 | + | ||
9 | +var _createTester2 = _interopRequireDefault(_createTester); | ||
10 | + | ||
11 | +var _doParallelLimit = require('./internal/doParallelLimit'); | ||
12 | + | ||
13 | +var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit); | ||
14 | + | ||
15 | +var _notId = require('./internal/notId'); | ||
16 | + | ||
17 | +var _notId2 = _interopRequireDefault(_notId); | ||
18 | + | ||
19 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
20 | + | ||
21 | +/** | ||
22 | + * The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time. | ||
23 | + * | ||
24 | + * @name everyLimit | ||
25 | + * @static | ||
26 | + * @memberOf module:Collections | ||
27 | + * @method | ||
28 | + * @see [async.every]{@link module:Collections.every} | ||
29 | + * @alias allLimit | ||
30 | + * @category Collection | ||
31 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
32 | + * @param {number} limit - The maximum number of async operations at a time. | ||
33 | + * @param {AsyncFunction} iteratee - An async truth test to apply to each item | ||
34 | + * in the collection in parallel. | ||
35 | + * The iteratee must complete with a boolean result value. | ||
36 | + * Invoked with (item, callback). | ||
37 | + * @param {Function} [callback] - A callback which is called after all the | ||
38 | + * `iteratee` functions have finished. Result will be either `true` or `false` | ||
39 | + * depending on the values of the async tests. Invoked with (err, result). | ||
40 | + */ | ||
41 | +exports.default = (0, _doParallelLimit2.default)((0, _createTester2.default)(_notId2.default, _notId2.default)); | ||
42 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/allSeries.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _everyLimit = require('./everyLimit'); | ||
8 | + | ||
9 | +var _everyLimit2 = _interopRequireDefault(_everyLimit); | ||
10 | + | ||
11 | +var _doLimit = require('./internal/doLimit'); | ||
12 | + | ||
13 | +var _doLimit2 = _interopRequireDefault(_doLimit); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time. | ||
19 | + * | ||
20 | + * @name everySeries | ||
21 | + * @static | ||
22 | + * @memberOf module:Collections | ||
23 | + * @method | ||
24 | + * @see [async.every]{@link module:Collections.every} | ||
25 | + * @alias allSeries | ||
26 | + * @category Collection | ||
27 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
28 | + * @param {AsyncFunction} iteratee - An async truth test to apply to each item | ||
29 | + * in the collection in series. | ||
30 | + * The iteratee must complete with a boolean result value. | ||
31 | + * Invoked with (item, callback). | ||
32 | + * @param {Function} [callback] - A callback which is called after all the | ||
33 | + * `iteratee` functions have finished. Result will be either `true` or `false` | ||
34 | + * depending on the values of the async tests. Invoked with (err, result). | ||
35 | + */ | ||
36 | +exports.default = (0, _doLimit2.default)(_everyLimit2.default, 1); | ||
37 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/any.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _createTester = require('./internal/createTester'); | ||
8 | + | ||
9 | +var _createTester2 = _interopRequireDefault(_createTester); | ||
10 | + | ||
11 | +var _doParallel = require('./internal/doParallel'); | ||
12 | + | ||
13 | +var _doParallel2 = _interopRequireDefault(_doParallel); | ||
14 | + | ||
15 | +var _identity = require('lodash/identity'); | ||
16 | + | ||
17 | +var _identity2 = _interopRequireDefault(_identity); | ||
18 | + | ||
19 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
20 | + | ||
21 | +/** | ||
22 | + * Returns `true` if at least one element in the `coll` satisfies an async test. | ||
23 | + * If any iteratee call returns `true`, the main `callback` is immediately | ||
24 | + * called. | ||
25 | + * | ||
26 | + * @name some | ||
27 | + * @static | ||
28 | + * @memberOf module:Collections | ||
29 | + * @method | ||
30 | + * @alias any | ||
31 | + * @category Collection | ||
32 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
33 | + * @param {AsyncFunction} iteratee - An async truth test to apply to each item | ||
34 | + * in the collections in parallel. | ||
35 | + * The iteratee should complete with a boolean `result` value. | ||
36 | + * Invoked with (item, callback). | ||
37 | + * @param {Function} [callback] - A callback which is called as soon as any | ||
38 | + * iteratee returns `true`, or after all the iteratee functions have finished. | ||
39 | + * Result will be either `true` or `false` depending on the values of the async | ||
40 | + * tests. Invoked with (err, result). | ||
41 | + * @example | ||
42 | + * | ||
43 | + * async.some(['file1','file2','file3'], function(filePath, callback) { | ||
44 | + * fs.access(filePath, function(err) { | ||
45 | + * callback(null, !err) | ||
46 | + * }); | ||
47 | + * }, function(err, result) { | ||
48 | + * // if result is true then at least one of the files exists | ||
49 | + * }); | ||
50 | + */ | ||
51 | +exports.default = (0, _doParallel2.default)((0, _createTester2.default)(Boolean, _identity2.default)); | ||
52 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/anyLimit.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _createTester = require('./internal/createTester'); | ||
8 | + | ||
9 | +var _createTester2 = _interopRequireDefault(_createTester); | ||
10 | + | ||
11 | +var _doParallelLimit = require('./internal/doParallelLimit'); | ||
12 | + | ||
13 | +var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit); | ||
14 | + | ||
15 | +var _identity = require('lodash/identity'); | ||
16 | + | ||
17 | +var _identity2 = _interopRequireDefault(_identity); | ||
18 | + | ||
19 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
20 | + | ||
21 | +/** | ||
22 | + * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time. | ||
23 | + * | ||
24 | + * @name someLimit | ||
25 | + * @static | ||
26 | + * @memberOf module:Collections | ||
27 | + * @method | ||
28 | + * @see [async.some]{@link module:Collections.some} | ||
29 | + * @alias anyLimit | ||
30 | + * @category Collection | ||
31 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
32 | + * @param {number} limit - The maximum number of async operations at a time. | ||
33 | + * @param {AsyncFunction} iteratee - An async truth test to apply to each item | ||
34 | + * in the collections in parallel. | ||
35 | + * The iteratee should complete with a boolean `result` value. | ||
36 | + * Invoked with (item, callback). | ||
37 | + * @param {Function} [callback] - A callback which is called as soon as any | ||
38 | + * iteratee returns `true`, or after all the iteratee functions have finished. | ||
39 | + * Result will be either `true` or `false` depending on the values of the async | ||
40 | + * tests. Invoked with (err, result). | ||
41 | + */ | ||
42 | +exports.default = (0, _doParallelLimit2.default)((0, _createTester2.default)(Boolean, _identity2.default)); | ||
43 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/anySeries.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _someLimit = require('./someLimit'); | ||
8 | + | ||
9 | +var _someLimit2 = _interopRequireDefault(_someLimit); | ||
10 | + | ||
11 | +var _doLimit = require('./internal/doLimit'); | ||
12 | + | ||
13 | +var _doLimit2 = _interopRequireDefault(_doLimit); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time. | ||
19 | + * | ||
20 | + * @name someSeries | ||
21 | + * @static | ||
22 | + * @memberOf module:Collections | ||
23 | + * @method | ||
24 | + * @see [async.some]{@link module:Collections.some} | ||
25 | + * @alias anySeries | ||
26 | + * @category Collection | ||
27 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
28 | + * @param {AsyncFunction} iteratee - An async truth test to apply to each item | ||
29 | + * in the collections in series. | ||
30 | + * The iteratee should complete with a boolean `result` value. | ||
31 | + * Invoked with (item, callback). | ||
32 | + * @param {Function} [callback] - A callback which is called as soon as any | ||
33 | + * iteratee returns `true`, or after all the iteratee functions have finished. | ||
34 | + * Result will be either `true` or `false` depending on the values of the async | ||
35 | + * tests. Invoked with (err, result). | ||
36 | + */ | ||
37 | +exports.default = (0, _doLimit2.default)(_someLimit2.default, 1); | ||
38 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/apply.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +exports.default = function (fn /*, ...args*/) { | ||
8 | + var args = (0, _slice2.default)(arguments, 1); | ||
9 | + return function () /*callArgs*/{ | ||
10 | + var callArgs = (0, _slice2.default)(arguments); | ||
11 | + return fn.apply(null, args.concat(callArgs)); | ||
12 | + }; | ||
13 | +}; | ||
14 | + | ||
15 | +var _slice = require('./internal/slice'); | ||
16 | + | ||
17 | +var _slice2 = _interopRequireDefault(_slice); | ||
18 | + | ||
19 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
20 | + | ||
21 | +; | ||
22 | + | ||
23 | +/** | ||
24 | + * Creates a continuation function with some arguments already applied. | ||
25 | + * | ||
26 | + * Useful as a shorthand when combined with other control flow functions. Any | ||
27 | + * arguments passed to the returned function are added to the arguments | ||
28 | + * originally passed to apply. | ||
29 | + * | ||
30 | + * @name apply | ||
31 | + * @static | ||
32 | + * @memberOf module:Utils | ||
33 | + * @method | ||
34 | + * @category Util | ||
35 | + * @param {Function} fn - The function you want to eventually apply all | ||
36 | + * arguments to. Invokes with (arguments...). | ||
37 | + * @param {...*} arguments... - Any number of arguments to automatically apply | ||
38 | + * when the continuation is called. | ||
39 | + * @returns {Function} the partially-applied function | ||
40 | + * @example | ||
41 | + * | ||
42 | + * // using apply | ||
43 | + * async.parallel([ | ||
44 | + * async.apply(fs.writeFile, 'testfile1', 'test1'), | ||
45 | + * async.apply(fs.writeFile, 'testfile2', 'test2') | ||
46 | + * ]); | ||
47 | + * | ||
48 | + * | ||
49 | + * // the same process without using apply | ||
50 | + * async.parallel([ | ||
51 | + * function(callback) { | ||
52 | + * fs.writeFile('testfile1', 'test1', callback); | ||
53 | + * }, | ||
54 | + * function(callback) { | ||
55 | + * fs.writeFile('testfile2', 'test2', callback); | ||
56 | + * } | ||
57 | + * ]); | ||
58 | + * | ||
59 | + * // It's possible to pass any number of additional arguments when calling the | ||
60 | + * // continuation: | ||
61 | + * | ||
62 | + * node> var fn = async.apply(sys.puts, 'one'); | ||
63 | + * node> fn('two', 'three'); | ||
64 | + * one | ||
65 | + * two | ||
66 | + * three | ||
67 | + */ | ||
68 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/applyEach.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _applyEach = require('./internal/applyEach'); | ||
8 | + | ||
9 | +var _applyEach2 = _interopRequireDefault(_applyEach); | ||
10 | + | ||
11 | +var _map = require('./map'); | ||
12 | + | ||
13 | +var _map2 = _interopRequireDefault(_map); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * Applies the provided arguments to each function in the array, calling | ||
19 | + * `callback` after all functions have completed. If you only provide the first | ||
20 | + * argument, `fns`, then it will return a function which lets you pass in the | ||
21 | + * arguments as if it were a single function call. If more arguments are | ||
22 | + * provided, `callback` is required while `args` is still optional. | ||
23 | + * | ||
24 | + * @name applyEach | ||
25 | + * @static | ||
26 | + * @memberOf module:ControlFlow | ||
27 | + * @method | ||
28 | + * @category Control Flow | ||
29 | + * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s | ||
30 | + * to all call with the same arguments | ||
31 | + * @param {...*} [args] - any number of separate arguments to pass to the | ||
32 | + * function. | ||
33 | + * @param {Function} [callback] - the final argument should be the callback, | ||
34 | + * called when all functions have completed processing. | ||
35 | + * @returns {Function} - If only the first argument, `fns`, is provided, it will | ||
36 | + * return a function which lets you pass in the arguments as if it were a single | ||
37 | + * function call. The signature is `(..args, callback)`. If invoked with any | ||
38 | + * arguments, `callback` is required. | ||
39 | + * @example | ||
40 | + * | ||
41 | + * async.applyEach([enableSearch, updateSchema], 'bucket', callback); | ||
42 | + * | ||
43 | + * // partial application example: | ||
44 | + * async.each( | ||
45 | + * buckets, | ||
46 | + * async.applyEach([enableSearch, updateSchema]), | ||
47 | + * callback | ||
48 | + * ); | ||
49 | + */ | ||
50 | +exports.default = (0, _applyEach2.default)(_map2.default); | ||
51 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/applyEachSeries.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _applyEach = require('./internal/applyEach'); | ||
8 | + | ||
9 | +var _applyEach2 = _interopRequireDefault(_applyEach); | ||
10 | + | ||
11 | +var _mapSeries = require('./mapSeries'); | ||
12 | + | ||
13 | +var _mapSeries2 = _interopRequireDefault(_mapSeries); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * The same as [`applyEach`]{@link module:ControlFlow.applyEach} but runs only a single async operation at a time. | ||
19 | + * | ||
20 | + * @name applyEachSeries | ||
21 | + * @static | ||
22 | + * @memberOf module:ControlFlow | ||
23 | + * @method | ||
24 | + * @see [async.applyEach]{@link module:ControlFlow.applyEach} | ||
25 | + * @category Control Flow | ||
26 | + * @param {Array|Iterable|Object} fns - A collection of {@link AsyncFunction}s to all | ||
27 | + * call with the same arguments | ||
28 | + * @param {...*} [args] - any number of separate arguments to pass to the | ||
29 | + * function. | ||
30 | + * @param {Function} [callback] - the final argument should be the callback, | ||
31 | + * called when all functions have completed processing. | ||
32 | + * @returns {Function} - If only the first argument is provided, it will return | ||
33 | + * a function which lets you pass in the arguments as if it were a single | ||
34 | + * function call. | ||
35 | + */ | ||
36 | +exports.default = (0, _applyEach2.default)(_mapSeries2.default); | ||
37 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/asyncify.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = asyncify; | ||
7 | + | ||
8 | +var _isObject = require('lodash/isObject'); | ||
9 | + | ||
10 | +var _isObject2 = _interopRequireDefault(_isObject); | ||
11 | + | ||
12 | +var _initialParams = require('./internal/initialParams'); | ||
13 | + | ||
14 | +var _initialParams2 = _interopRequireDefault(_initialParams); | ||
15 | + | ||
16 | +var _setImmediate = require('./internal/setImmediate'); | ||
17 | + | ||
18 | +var _setImmediate2 = _interopRequireDefault(_setImmediate); | ||
19 | + | ||
20 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
21 | + | ||
22 | +/** | ||
23 | + * Take a sync function and make it async, passing its return value to a | ||
24 | + * callback. This is useful for plugging sync functions into a waterfall, | ||
25 | + * series, or other async functions. Any arguments passed to the generated | ||
26 | + * function will be passed to the wrapped function (except for the final | ||
27 | + * callback argument). Errors thrown will be passed to the callback. | ||
28 | + * | ||
29 | + * If the function passed to `asyncify` returns a Promise, that promises's | ||
30 | + * resolved/rejected state will be used to call the callback, rather than simply | ||
31 | + * the synchronous return value. | ||
32 | + * | ||
33 | + * This also means you can asyncify ES2017 `async` functions. | ||
34 | + * | ||
35 | + * @name asyncify | ||
36 | + * @static | ||
37 | + * @memberOf module:Utils | ||
38 | + * @method | ||
39 | + * @alias wrapSync | ||
40 | + * @category Util | ||
41 | + * @param {Function} func - The synchronous function, or Promise-returning | ||
42 | + * function to convert to an {@link AsyncFunction}. | ||
43 | + * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be | ||
44 | + * invoked with `(args..., callback)`. | ||
45 | + * @example | ||
46 | + * | ||
47 | + * // passing a regular synchronous function | ||
48 | + * async.waterfall([ | ||
49 | + * async.apply(fs.readFile, filename, "utf8"), | ||
50 | + * async.asyncify(JSON.parse), | ||
51 | + * function (data, next) { | ||
52 | + * // data is the result of parsing the text. | ||
53 | + * // If there was a parsing error, it would have been caught. | ||
54 | + * } | ||
55 | + * ], callback); | ||
56 | + * | ||
57 | + * // passing a function returning a promise | ||
58 | + * async.waterfall([ | ||
59 | + * async.apply(fs.readFile, filename, "utf8"), | ||
60 | + * async.asyncify(function (contents) { | ||
61 | + * return db.model.create(contents); | ||
62 | + * }), | ||
63 | + * function (model, next) { | ||
64 | + * // `model` is the instantiated model object. | ||
65 | + * // If there was an error, this function would be skipped. | ||
66 | + * } | ||
67 | + * ], callback); | ||
68 | + * | ||
69 | + * // es2017 example, though `asyncify` is not needed if your JS environment | ||
70 | + * // supports async functions out of the box | ||
71 | + * var q = async.queue(async.asyncify(async function(file) { | ||
72 | + * var intermediateStep = await processFile(file); | ||
73 | + * return await somePromise(intermediateStep) | ||
74 | + * })); | ||
75 | + * | ||
76 | + * q.push(files); | ||
77 | + */ | ||
78 | +function asyncify(func) { | ||
79 | + return (0, _initialParams2.default)(function (args, callback) { | ||
80 | + var result; | ||
81 | + try { | ||
82 | + result = func.apply(this, args); | ||
83 | + } catch (e) { | ||
84 | + return callback(e); | ||
85 | + } | ||
86 | + // if result is Promise object | ||
87 | + if ((0, _isObject2.default)(result) && typeof result.then === 'function') { | ||
88 | + result.then(function (value) { | ||
89 | + invokeCallback(callback, null, value); | ||
90 | + }, function (err) { | ||
91 | + invokeCallback(callback, err.message ? err : new Error(err)); | ||
92 | + }); | ||
93 | + } else { | ||
94 | + callback(null, result); | ||
95 | + } | ||
96 | + }); | ||
97 | +} | ||
98 | + | ||
99 | +function invokeCallback(callback, error, value) { | ||
100 | + try { | ||
101 | + callback(error, value); | ||
102 | + } catch (e) { | ||
103 | + (0, _setImmediate2.default)(rethrow, e); | ||
104 | + } | ||
105 | +} | ||
106 | + | ||
107 | +function rethrow(error) { | ||
108 | + throw error; | ||
109 | +} | ||
110 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/auto.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +exports.default = function (tasks, concurrency, callback) { | ||
8 | + if (typeof concurrency === 'function') { | ||
9 | + // concurrency is optional, shift the args. | ||
10 | + callback = concurrency; | ||
11 | + concurrency = null; | ||
12 | + } | ||
13 | + callback = (0, _once2.default)(callback || _noop2.default); | ||
14 | + var keys = (0, _keys2.default)(tasks); | ||
15 | + var numTasks = keys.length; | ||
16 | + if (!numTasks) { | ||
17 | + return callback(null); | ||
18 | + } | ||
19 | + if (!concurrency) { | ||
20 | + concurrency = numTasks; | ||
21 | + } | ||
22 | + | ||
23 | + var results = {}; | ||
24 | + var runningTasks = 0; | ||
25 | + var hasError = false; | ||
26 | + | ||
27 | + var listeners = Object.create(null); | ||
28 | + | ||
29 | + var readyTasks = []; | ||
30 | + | ||
31 | + // for cycle detection: | ||
32 | + var readyToCheck = []; // tasks that have been identified as reachable | ||
33 | + // without the possibility of returning to an ancestor task | ||
34 | + var uncheckedDependencies = {}; | ||
35 | + | ||
36 | + (0, _baseForOwn2.default)(tasks, function (task, key) { | ||
37 | + if (!(0, _isArray2.default)(task)) { | ||
38 | + // no dependencies | ||
39 | + enqueueTask(key, [task]); | ||
40 | + readyToCheck.push(key); | ||
41 | + return; | ||
42 | + } | ||
43 | + | ||
44 | + var dependencies = task.slice(0, task.length - 1); | ||
45 | + var remainingDependencies = dependencies.length; | ||
46 | + if (remainingDependencies === 0) { | ||
47 | + enqueueTask(key, task); | ||
48 | + readyToCheck.push(key); | ||
49 | + return; | ||
50 | + } | ||
51 | + uncheckedDependencies[key] = remainingDependencies; | ||
52 | + | ||
53 | + (0, _arrayEach2.default)(dependencies, function (dependencyName) { | ||
54 | + if (!tasks[dependencyName]) { | ||
55 | + throw new Error('async.auto task `' + key + '` has a non-existent dependency `' + dependencyName + '` in ' + dependencies.join(', ')); | ||
56 | + } | ||
57 | + addListener(dependencyName, function () { | ||
58 | + remainingDependencies--; | ||
59 | + if (remainingDependencies === 0) { | ||
60 | + enqueueTask(key, task); | ||
61 | + } | ||
62 | + }); | ||
63 | + }); | ||
64 | + }); | ||
65 | + | ||
66 | + checkForDeadlocks(); | ||
67 | + processQueue(); | ||
68 | + | ||
69 | + function enqueueTask(key, task) { | ||
70 | + readyTasks.push(function () { | ||
71 | + runTask(key, task); | ||
72 | + }); | ||
73 | + } | ||
74 | + | ||
75 | + function processQueue() { | ||
76 | + if (readyTasks.length === 0 && runningTasks === 0) { | ||
77 | + return callback(null, results); | ||
78 | + } | ||
79 | + while (readyTasks.length && runningTasks < concurrency) { | ||
80 | + var run = readyTasks.shift(); | ||
81 | + run(); | ||
82 | + } | ||
83 | + } | ||
84 | + | ||
85 | + function addListener(taskName, fn) { | ||
86 | + var taskListeners = listeners[taskName]; | ||
87 | + if (!taskListeners) { | ||
88 | + taskListeners = listeners[taskName] = []; | ||
89 | + } | ||
90 | + | ||
91 | + taskListeners.push(fn); | ||
92 | + } | ||
93 | + | ||
94 | + function taskComplete(taskName) { | ||
95 | + var taskListeners = listeners[taskName] || []; | ||
96 | + (0, _arrayEach2.default)(taskListeners, function (fn) { | ||
97 | + fn(); | ||
98 | + }); | ||
99 | + processQueue(); | ||
100 | + } | ||
101 | + | ||
102 | + function runTask(key, task) { | ||
103 | + if (hasError) return; | ||
104 | + | ||
105 | + var taskCallback = (0, _onlyOnce2.default)(function (err, result) { | ||
106 | + runningTasks--; | ||
107 | + if (arguments.length > 2) { | ||
108 | + result = (0, _slice2.default)(arguments, 1); | ||
109 | + } | ||
110 | + if (err) { | ||
111 | + var safeResults = {}; | ||
112 | + (0, _baseForOwn2.default)(results, function (val, rkey) { | ||
113 | + safeResults[rkey] = val; | ||
114 | + }); | ||
115 | + safeResults[key] = result; | ||
116 | + hasError = true; | ||
117 | + listeners = Object.create(null); | ||
118 | + | ||
119 | + callback(err, safeResults); | ||
120 | + } else { | ||
121 | + results[key] = result; | ||
122 | + taskComplete(key); | ||
123 | + } | ||
124 | + }); | ||
125 | + | ||
126 | + runningTasks++; | ||
127 | + var taskFn = (0, _wrapAsync2.default)(task[task.length - 1]); | ||
128 | + if (task.length > 1) { | ||
129 | + taskFn(results, taskCallback); | ||
130 | + } else { | ||
131 | + taskFn(taskCallback); | ||
132 | + } | ||
133 | + } | ||
134 | + | ||
135 | + function checkForDeadlocks() { | ||
136 | + // Kahn's algorithm | ||
137 | + // https://en.wikipedia.org/wiki/Topological_sorting#Kahn.27s_algorithm | ||
138 | + // http://connalle.blogspot.com/2013/10/topological-sortingkahn-algorithm.html | ||
139 | + var currentTask; | ||
140 | + var counter = 0; | ||
141 | + while (readyToCheck.length) { | ||
142 | + currentTask = readyToCheck.pop(); | ||
143 | + counter++; | ||
144 | + (0, _arrayEach2.default)(getDependents(currentTask), function (dependent) { | ||
145 | + if (--uncheckedDependencies[dependent] === 0) { | ||
146 | + readyToCheck.push(dependent); | ||
147 | + } | ||
148 | + }); | ||
149 | + } | ||
150 | + | ||
151 | + if (counter !== numTasks) { | ||
152 | + throw new Error('async.auto cannot execute tasks due to a recursive dependency'); | ||
153 | + } | ||
154 | + } | ||
155 | + | ||
156 | + function getDependents(taskName) { | ||
157 | + var result = []; | ||
158 | + (0, _baseForOwn2.default)(tasks, function (task, key) { | ||
159 | + if ((0, _isArray2.default)(task) && (0, _baseIndexOf2.default)(task, taskName, 0) >= 0) { | ||
160 | + result.push(key); | ||
161 | + } | ||
162 | + }); | ||
163 | + return result; | ||
164 | + } | ||
165 | +}; | ||
166 | + | ||
167 | +var _arrayEach = require('lodash/_arrayEach'); | ||
168 | + | ||
169 | +var _arrayEach2 = _interopRequireDefault(_arrayEach); | ||
170 | + | ||
171 | +var _baseForOwn = require('lodash/_baseForOwn'); | ||
172 | + | ||
173 | +var _baseForOwn2 = _interopRequireDefault(_baseForOwn); | ||
174 | + | ||
175 | +var _baseIndexOf = require('lodash/_baseIndexOf'); | ||
176 | + | ||
177 | +var _baseIndexOf2 = _interopRequireDefault(_baseIndexOf); | ||
178 | + | ||
179 | +var _isArray = require('lodash/isArray'); | ||
180 | + | ||
181 | +var _isArray2 = _interopRequireDefault(_isArray); | ||
182 | + | ||
183 | +var _keys = require('lodash/keys'); | ||
184 | + | ||
185 | +var _keys2 = _interopRequireDefault(_keys); | ||
186 | + | ||
187 | +var _noop = require('lodash/noop'); | ||
188 | + | ||
189 | +var _noop2 = _interopRequireDefault(_noop); | ||
190 | + | ||
191 | +var _slice = require('./internal/slice'); | ||
192 | + | ||
193 | +var _slice2 = _interopRequireDefault(_slice); | ||
194 | + | ||
195 | +var _once = require('./internal/once'); | ||
196 | + | ||
197 | +var _once2 = _interopRequireDefault(_once); | ||
198 | + | ||
199 | +var _onlyOnce = require('./internal/onlyOnce'); | ||
200 | + | ||
201 | +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); | ||
202 | + | ||
203 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
204 | + | ||
205 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
206 | + | ||
207 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
208 | + | ||
209 | +module.exports = exports['default']; | ||
210 | + | ||
211 | +/** | ||
212 | + * Determines the best order for running the {@link AsyncFunction}s in `tasks`, based on | ||
213 | + * their requirements. Each function can optionally depend on other functions | ||
214 | + * being completed first, and each function is run as soon as its requirements | ||
215 | + * are satisfied. | ||
216 | + * | ||
217 | + * If any of the {@link AsyncFunction}s pass an error to their callback, the `auto` sequence | ||
218 | + * will stop. Further tasks will not execute (so any other functions depending | ||
219 | + * on it will not run), and the main `callback` is immediately called with the | ||
220 | + * error. | ||
221 | + * | ||
222 | + * {@link AsyncFunction}s also receive an object containing the results of functions which | ||
223 | + * have completed so far as the first argument, if they have dependencies. If a | ||
224 | + * task function has no dependencies, it will only be passed a callback. | ||
225 | + * | ||
226 | + * @name auto | ||
227 | + * @static | ||
228 | + * @memberOf module:ControlFlow | ||
229 | + * @method | ||
230 | + * @category Control Flow | ||
231 | + * @param {Object} tasks - An object. Each of its properties is either a | ||
232 | + * function or an array of requirements, with the {@link AsyncFunction} itself the last item | ||
233 | + * in the array. The object's key of a property serves as the name of the task | ||
234 | + * defined by that property, i.e. can be used when specifying requirements for | ||
235 | + * other tasks. The function receives one or two arguments: | ||
236 | + * * a `results` object, containing the results of the previously executed | ||
237 | + * functions, only passed if the task has any dependencies, | ||
238 | + * * a `callback(err, result)` function, which must be called when finished, | ||
239 | + * passing an `error` (which can be `null`) and the result of the function's | ||
240 | + * execution. | ||
241 | + * @param {number} [concurrency=Infinity] - An optional `integer` for | ||
242 | + * determining the maximum number of tasks that can be run in parallel. By | ||
243 | + * default, as many as possible. | ||
244 | + * @param {Function} [callback] - An optional callback which is called when all | ||
245 | + * the tasks have been completed. It receives the `err` argument if any `tasks` | ||
246 | + * pass an error to their callback. Results are always returned; however, if an | ||
247 | + * error occurs, no further `tasks` will be performed, and the results object | ||
248 | + * will only contain partial results. Invoked with (err, results). | ||
249 | + * @returns undefined | ||
250 | + * @example | ||
251 | + * | ||
252 | + * async.auto({ | ||
253 | + * // this function will just be passed a callback | ||
254 | + * readData: async.apply(fs.readFile, 'data.txt', 'utf-8'), | ||
255 | + * showData: ['readData', function(results, cb) { | ||
256 | + * // results.readData is the file's contents | ||
257 | + * // ... | ||
258 | + * }] | ||
259 | + * }, callback); | ||
260 | + * | ||
261 | + * async.auto({ | ||
262 | + * get_data: function(callback) { | ||
263 | + * console.log('in get_data'); | ||
264 | + * // async code to get some data | ||
265 | + * callback(null, 'data', 'converted to array'); | ||
266 | + * }, | ||
267 | + * make_folder: function(callback) { | ||
268 | + * console.log('in make_folder'); | ||
269 | + * // async code to create a directory to store a file in | ||
270 | + * // this is run at the same time as getting the data | ||
271 | + * callback(null, 'folder'); | ||
272 | + * }, | ||
273 | + * write_file: ['get_data', 'make_folder', function(results, callback) { | ||
274 | + * console.log('in write_file', JSON.stringify(results)); | ||
275 | + * // once there is some data and the directory exists, | ||
276 | + * // write the data to a file in the directory | ||
277 | + * callback(null, 'filename'); | ||
278 | + * }], | ||
279 | + * email_link: ['write_file', function(results, callback) { | ||
280 | + * console.log('in email_link', JSON.stringify(results)); | ||
281 | + * // once the file is written let's email a link to it... | ||
282 | + * // results.write_file contains the filename returned by write_file. | ||
283 | + * callback(null, {'file':results.write_file, 'email':'user@example.com'}); | ||
284 | + * }] | ||
285 | + * }, function(err, results) { | ||
286 | + * console.log('err = ', err); | ||
287 | + * console.log('results = ', results); | ||
288 | + * }); | ||
289 | + */ | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/autoInject.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = autoInject; | ||
7 | + | ||
8 | +var _auto = require('./auto'); | ||
9 | + | ||
10 | +var _auto2 = _interopRequireDefault(_auto); | ||
11 | + | ||
12 | +var _baseForOwn = require('lodash/_baseForOwn'); | ||
13 | + | ||
14 | +var _baseForOwn2 = _interopRequireDefault(_baseForOwn); | ||
15 | + | ||
16 | +var _arrayMap = require('lodash/_arrayMap'); | ||
17 | + | ||
18 | +var _arrayMap2 = _interopRequireDefault(_arrayMap); | ||
19 | + | ||
20 | +var _isArray = require('lodash/isArray'); | ||
21 | + | ||
22 | +var _isArray2 = _interopRequireDefault(_isArray); | ||
23 | + | ||
24 | +var _trim = require('lodash/trim'); | ||
25 | + | ||
26 | +var _trim2 = _interopRequireDefault(_trim); | ||
27 | + | ||
28 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
29 | + | ||
30 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
31 | + | ||
32 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
33 | + | ||
34 | +var FN_ARGS = /^(?:async\s+)?(function)?\s*[^\(]*\(\s*([^\)]*)\)/m; | ||
35 | +var FN_ARG_SPLIT = /,/; | ||
36 | +var FN_ARG = /(=.+)?(\s*)$/; | ||
37 | +var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; | ||
38 | + | ||
39 | +function parseParams(func) { | ||
40 | + func = func.toString().replace(STRIP_COMMENTS, ''); | ||
41 | + func = func.match(FN_ARGS)[2].replace(' ', ''); | ||
42 | + func = func ? func.split(FN_ARG_SPLIT) : []; | ||
43 | + func = func.map(function (arg) { | ||
44 | + return (0, _trim2.default)(arg.replace(FN_ARG, '')); | ||
45 | + }); | ||
46 | + return func; | ||
47 | +} | ||
48 | + | ||
49 | +/** | ||
50 | + * A dependency-injected version of the [async.auto]{@link module:ControlFlow.auto} function. Dependent | ||
51 | + * tasks are specified as parameters to the function, after the usual callback | ||
52 | + * parameter, with the parameter names matching the names of the tasks it | ||
53 | + * depends on. This can provide even more readable task graphs which can be | ||
54 | + * easier to maintain. | ||
55 | + * | ||
56 | + * If a final callback is specified, the task results are similarly injected, | ||
57 | + * specified as named parameters after the initial error parameter. | ||
58 | + * | ||
59 | + * The autoInject function is purely syntactic sugar and its semantics are | ||
60 | + * otherwise equivalent to [async.auto]{@link module:ControlFlow.auto}. | ||
61 | + * | ||
62 | + * @name autoInject | ||
63 | + * @static | ||
64 | + * @memberOf module:ControlFlow | ||
65 | + * @method | ||
66 | + * @see [async.auto]{@link module:ControlFlow.auto} | ||
67 | + * @category Control Flow | ||
68 | + * @param {Object} tasks - An object, each of whose properties is an {@link AsyncFunction} of | ||
69 | + * the form 'func([dependencies...], callback). The object's key of a property | ||
70 | + * serves as the name of the task defined by that property, i.e. can be used | ||
71 | + * when specifying requirements for other tasks. | ||
72 | + * * The `callback` parameter is a `callback(err, result)` which must be called | ||
73 | + * when finished, passing an `error` (which can be `null`) and the result of | ||
74 | + * the function's execution. The remaining parameters name other tasks on | ||
75 | + * which the task is dependent, and the results from those tasks are the | ||
76 | + * arguments of those parameters. | ||
77 | + * @param {Function} [callback] - An optional callback which is called when all | ||
78 | + * the tasks have been completed. It receives the `err` argument if any `tasks` | ||
79 | + * pass an error to their callback, and a `results` object with any completed | ||
80 | + * task results, similar to `auto`. | ||
81 | + * @example | ||
82 | + * | ||
83 | + * // The example from `auto` can be rewritten as follows: | ||
84 | + * async.autoInject({ | ||
85 | + * get_data: function(callback) { | ||
86 | + * // async code to get some data | ||
87 | + * callback(null, 'data', 'converted to array'); | ||
88 | + * }, | ||
89 | + * make_folder: function(callback) { | ||
90 | + * // async code to create a directory to store a file in | ||
91 | + * // this is run at the same time as getting the data | ||
92 | + * callback(null, 'folder'); | ||
93 | + * }, | ||
94 | + * write_file: function(get_data, make_folder, callback) { | ||
95 | + * // once there is some data and the directory exists, | ||
96 | + * // write the data to a file in the directory | ||
97 | + * callback(null, 'filename'); | ||
98 | + * }, | ||
99 | + * email_link: function(write_file, callback) { | ||
100 | + * // once the file is written let's email a link to it... | ||
101 | + * // write_file contains the filename returned by write_file. | ||
102 | + * callback(null, {'file':write_file, 'email':'user@example.com'}); | ||
103 | + * } | ||
104 | + * }, function(err, results) { | ||
105 | + * console.log('err = ', err); | ||
106 | + * console.log('email_link = ', results.email_link); | ||
107 | + * }); | ||
108 | + * | ||
109 | + * // If you are using a JS minifier that mangles parameter names, `autoInject` | ||
110 | + * // will not work with plain functions, since the parameter names will be | ||
111 | + * // collapsed to a single letter identifier. To work around this, you can | ||
112 | + * // explicitly specify the names of the parameters your task function needs | ||
113 | + * // in an array, similar to Angular.js dependency injection. | ||
114 | + * | ||
115 | + * // This still has an advantage over plain `auto`, since the results a task | ||
116 | + * // depends on are still spread into arguments. | ||
117 | + * async.autoInject({ | ||
118 | + * //... | ||
119 | + * write_file: ['get_data', 'make_folder', function(get_data, make_folder, callback) { | ||
120 | + * callback(null, 'filename'); | ||
121 | + * }], | ||
122 | + * email_link: ['write_file', function(write_file, callback) { | ||
123 | + * callback(null, {'file':write_file, 'email':'user@example.com'}); | ||
124 | + * }] | ||
125 | + * //... | ||
126 | + * }, function(err, results) { | ||
127 | + * console.log('err = ', err); | ||
128 | + * console.log('email_link = ', results.email_link); | ||
129 | + * }); | ||
130 | + */ | ||
131 | +function autoInject(tasks, callback) { | ||
132 | + var newTasks = {}; | ||
133 | + | ||
134 | + (0, _baseForOwn2.default)(tasks, function (taskFn, key) { | ||
135 | + var params; | ||
136 | + var fnIsAsync = (0, _wrapAsync.isAsync)(taskFn); | ||
137 | + var hasNoDeps = !fnIsAsync && taskFn.length === 1 || fnIsAsync && taskFn.length === 0; | ||
138 | + | ||
139 | + if ((0, _isArray2.default)(taskFn)) { | ||
140 | + params = taskFn.slice(0, -1); | ||
141 | + taskFn = taskFn[taskFn.length - 1]; | ||
142 | + | ||
143 | + newTasks[key] = params.concat(params.length > 0 ? newTask : taskFn); | ||
144 | + } else if (hasNoDeps) { | ||
145 | + // no dependencies, use the function as-is | ||
146 | + newTasks[key] = taskFn; | ||
147 | + } else { | ||
148 | + params = parseParams(taskFn); | ||
149 | + if (taskFn.length === 0 && !fnIsAsync && params.length === 0) { | ||
150 | + throw new Error("autoInject task functions require explicit parameters."); | ||
151 | + } | ||
152 | + | ||
153 | + // remove callback param | ||
154 | + if (!fnIsAsync) params.pop(); | ||
155 | + | ||
156 | + newTasks[key] = params.concat(newTask); | ||
157 | + } | ||
158 | + | ||
159 | + function newTask(results, taskCb) { | ||
160 | + var newArgs = (0, _arrayMap2.default)(params, function (name) { | ||
161 | + return results[name]; | ||
162 | + }); | ||
163 | + newArgs.push(taskCb); | ||
164 | + (0, _wrapAsync2.default)(taskFn).apply(null, newArgs); | ||
165 | + } | ||
166 | + }); | ||
167 | + | ||
168 | + (0, _auto2.default)(newTasks, callback); | ||
169 | +} | ||
170 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/bower.json
0 → 100644
node_modules/async/cargo.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = cargo; | ||
7 | + | ||
8 | +var _queue = require('./internal/queue'); | ||
9 | + | ||
10 | +var _queue2 = _interopRequireDefault(_queue); | ||
11 | + | ||
12 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
13 | + | ||
14 | +/** | ||
15 | + * A cargo of tasks for the worker function to complete. Cargo inherits all of | ||
16 | + * the same methods and event callbacks as [`queue`]{@link module:ControlFlow.queue}. | ||
17 | + * @typedef {Object} CargoObject | ||
18 | + * @memberOf module:ControlFlow | ||
19 | + * @property {Function} length - A function returning the number of items | ||
20 | + * waiting to be processed. Invoke like `cargo.length()`. | ||
21 | + * @property {number} payload - An `integer` for determining how many tasks | ||
22 | + * should be process per round. This property can be changed after a `cargo` is | ||
23 | + * created to alter the payload on-the-fly. | ||
24 | + * @property {Function} push - Adds `task` to the `queue`. The callback is | ||
25 | + * called once the `worker` has finished processing the task. Instead of a | ||
26 | + * single task, an array of `tasks` can be submitted. The respective callback is | ||
27 | + * used for every task in the list. Invoke like `cargo.push(task, [callback])`. | ||
28 | + * @property {Function} saturated - A callback that is called when the | ||
29 | + * `queue.length()` hits the concurrency and further tasks will be queued. | ||
30 | + * @property {Function} empty - A callback that is called when the last item | ||
31 | + * from the `queue` is given to a `worker`. | ||
32 | + * @property {Function} drain - A callback that is called when the last item | ||
33 | + * from the `queue` has returned from the `worker`. | ||
34 | + * @property {Function} idle - a function returning false if there are items | ||
35 | + * waiting or being processed, or true if not. Invoke like `cargo.idle()`. | ||
36 | + * @property {Function} pause - a function that pauses the processing of tasks | ||
37 | + * until `resume()` is called. Invoke like `cargo.pause()`. | ||
38 | + * @property {Function} resume - a function that resumes the processing of | ||
39 | + * queued tasks when the queue is paused. Invoke like `cargo.resume()`. | ||
40 | + * @property {Function} kill - a function that removes the `drain` callback and | ||
41 | + * empties remaining tasks from the queue forcing it to go idle. Invoke like `cargo.kill()`. | ||
42 | + */ | ||
43 | + | ||
44 | +/** | ||
45 | + * Creates a `cargo` object with the specified payload. Tasks added to the | ||
46 | + * cargo will be processed altogether (up to the `payload` limit). If the | ||
47 | + * `worker` is in progress, the task is queued until it becomes available. Once | ||
48 | + * the `worker` has completed some tasks, each callback of those tasks is | ||
49 | + * called. Check out [these](https://camo.githubusercontent.com/6bbd36f4cf5b35a0f11a96dcd2e97711ffc2fb37/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130382f62626330636662302d356632392d313165322d393734662d3333393763363464633835382e676966) [animations](https://camo.githubusercontent.com/f4810e00e1c5f5f8addbe3e9f49064fd5d102699/68747470733a2f2f662e636c6f75642e6769746875622e636f6d2f6173736574732f313637363837312f36383130312f38346339323036362d356632392d313165322d383134662d3964336430323431336266642e676966) | ||
50 | + * for how `cargo` and `queue` work. | ||
51 | + * | ||
52 | + * While [`queue`]{@link module:ControlFlow.queue} passes only one task to one of a group of workers | ||
53 | + * at a time, cargo passes an array of tasks to a single worker, repeating | ||
54 | + * when the worker is finished. | ||
55 | + * | ||
56 | + * @name cargo | ||
57 | + * @static | ||
58 | + * @memberOf module:ControlFlow | ||
59 | + * @method | ||
60 | + * @see [async.queue]{@link module:ControlFlow.queue} | ||
61 | + * @category Control Flow | ||
62 | + * @param {AsyncFunction} worker - An asynchronous function for processing an array | ||
63 | + * of queued tasks. Invoked with `(tasks, callback)`. | ||
64 | + * @param {number} [payload=Infinity] - An optional `integer` for determining | ||
65 | + * how many tasks should be processed per round; if omitted, the default is | ||
66 | + * unlimited. | ||
67 | + * @returns {module:ControlFlow.CargoObject} A cargo object to manage the tasks. Callbacks can | ||
68 | + * attached as certain properties to listen for specific events during the | ||
69 | + * lifecycle of the cargo and inner queue. | ||
70 | + * @example | ||
71 | + * | ||
72 | + * // create a cargo object with payload 2 | ||
73 | + * var cargo = async.cargo(function(tasks, callback) { | ||
74 | + * for (var i=0; i<tasks.length; i++) { | ||
75 | + * console.log('hello ' + tasks[i].name); | ||
76 | + * } | ||
77 | + * callback(); | ||
78 | + * }, 2); | ||
79 | + * | ||
80 | + * // add some items | ||
81 | + * cargo.push({name: 'foo'}, function(err) { | ||
82 | + * console.log('finished processing foo'); | ||
83 | + * }); | ||
84 | + * cargo.push({name: 'bar'}, function(err) { | ||
85 | + * console.log('finished processing bar'); | ||
86 | + * }); | ||
87 | + * cargo.push({name: 'baz'}, function(err) { | ||
88 | + * console.log('finished processing baz'); | ||
89 | + * }); | ||
90 | + */ | ||
91 | +function cargo(worker, payload) { | ||
92 | + return (0, _queue2.default)(worker, 1, payload); | ||
93 | +} | ||
94 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/compose.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +exports.default = function () /*...args*/{ | ||
8 | + return _seq2.default.apply(null, (0, _slice2.default)(arguments).reverse()); | ||
9 | +}; | ||
10 | + | ||
11 | +var _seq = require('./seq'); | ||
12 | + | ||
13 | +var _seq2 = _interopRequireDefault(_seq); | ||
14 | + | ||
15 | +var _slice = require('./internal/slice'); | ||
16 | + | ||
17 | +var _slice2 = _interopRequireDefault(_slice); | ||
18 | + | ||
19 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
20 | + | ||
21 | +; | ||
22 | + | ||
23 | +/** | ||
24 | + * Creates a function which is a composition of the passed asynchronous | ||
25 | + * functions. Each function consumes the return value of the function that | ||
26 | + * follows. Composing functions `f()`, `g()`, and `h()` would produce the result | ||
27 | + * of `f(g(h()))`, only this version uses callbacks to obtain the return values. | ||
28 | + * | ||
29 | + * Each function is executed with the `this` binding of the composed function. | ||
30 | + * | ||
31 | + * @name compose | ||
32 | + * @static | ||
33 | + * @memberOf module:ControlFlow | ||
34 | + * @method | ||
35 | + * @category Control Flow | ||
36 | + * @param {...AsyncFunction} functions - the asynchronous functions to compose | ||
37 | + * @returns {Function} an asynchronous function that is the composed | ||
38 | + * asynchronous `functions` | ||
39 | + * @example | ||
40 | + * | ||
41 | + * function add1(n, callback) { | ||
42 | + * setTimeout(function () { | ||
43 | + * callback(null, n + 1); | ||
44 | + * }, 10); | ||
45 | + * } | ||
46 | + * | ||
47 | + * function mul3(n, callback) { | ||
48 | + * setTimeout(function () { | ||
49 | + * callback(null, n * 3); | ||
50 | + * }, 10); | ||
51 | + * } | ||
52 | + * | ||
53 | + * var add1mul3 = async.compose(mul3, add1); | ||
54 | + * add1mul3(4, function (err, result) { | ||
55 | + * // result now equals 15 | ||
56 | + * }); | ||
57 | + */ | ||
58 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/concat.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _doLimit = require('./internal/doLimit'); | ||
8 | + | ||
9 | +var _doLimit2 = _interopRequireDefault(_doLimit); | ||
10 | + | ||
11 | +var _concatLimit = require('./concatLimit'); | ||
12 | + | ||
13 | +var _concatLimit2 = _interopRequireDefault(_concatLimit); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * Applies `iteratee` to each item in `coll`, concatenating the results. Returns | ||
19 | + * the concatenated list. The `iteratee`s are called in parallel, and the | ||
20 | + * results are concatenated as they return. There is no guarantee that the | ||
21 | + * results array will be returned in the original order of `coll` passed to the | ||
22 | + * `iteratee` function. | ||
23 | + * | ||
24 | + * @name concat | ||
25 | + * @static | ||
26 | + * @memberOf module:Collections | ||
27 | + * @method | ||
28 | + * @category Collection | ||
29 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
30 | + * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`, | ||
31 | + * which should use an array as its result. Invoked with (item, callback). | ||
32 | + * @param {Function} [callback(err)] - A callback which is called after all the | ||
33 | + * `iteratee` functions have finished, or an error occurs. Results is an array | ||
34 | + * containing the concatenated results of the `iteratee` function. Invoked with | ||
35 | + * (err, results). | ||
36 | + * @example | ||
37 | + * | ||
38 | + * async.concat(['dir1','dir2','dir3'], fs.readdir, function(err, files) { | ||
39 | + * // files is now a list of filenames that exist in the 3 directories | ||
40 | + * }); | ||
41 | + */ | ||
42 | +exports.default = (0, _doLimit2.default)(_concatLimit2.default, Infinity); | ||
43 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/concatLimit.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +exports.default = function (coll, limit, iteratee, callback) { | ||
8 | + callback = callback || _noop2.default; | ||
9 | + var _iteratee = (0, _wrapAsync2.default)(iteratee); | ||
10 | + (0, _mapLimit2.default)(coll, limit, function (val, callback) { | ||
11 | + _iteratee(val, function (err /*, ...args*/) { | ||
12 | + if (err) return callback(err); | ||
13 | + return callback(null, (0, _slice2.default)(arguments, 1)); | ||
14 | + }); | ||
15 | + }, function (err, mapResults) { | ||
16 | + var result = []; | ||
17 | + for (var i = 0; i < mapResults.length; i++) { | ||
18 | + if (mapResults[i]) { | ||
19 | + result = _concat.apply(result, mapResults[i]); | ||
20 | + } | ||
21 | + } | ||
22 | + | ||
23 | + return callback(err, result); | ||
24 | + }); | ||
25 | +}; | ||
26 | + | ||
27 | +var _noop = require('lodash/noop'); | ||
28 | + | ||
29 | +var _noop2 = _interopRequireDefault(_noop); | ||
30 | + | ||
31 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
32 | + | ||
33 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
34 | + | ||
35 | +var _slice = require('./internal/slice'); | ||
36 | + | ||
37 | +var _slice2 = _interopRequireDefault(_slice); | ||
38 | + | ||
39 | +var _mapLimit = require('./mapLimit'); | ||
40 | + | ||
41 | +var _mapLimit2 = _interopRequireDefault(_mapLimit); | ||
42 | + | ||
43 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
44 | + | ||
45 | +var _concat = Array.prototype.concat; | ||
46 | + | ||
47 | +/** | ||
48 | + * The same as [`concat`]{@link module:Collections.concat} but runs a maximum of `limit` async operations at a time. | ||
49 | + * | ||
50 | + * @name concatLimit | ||
51 | + * @static | ||
52 | + * @memberOf module:Collections | ||
53 | + * @method | ||
54 | + * @see [async.concat]{@link module:Collections.concat} | ||
55 | + * @category Collection | ||
56 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
57 | + * @param {number} limit - The maximum number of async operations at a time. | ||
58 | + * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`, | ||
59 | + * which should use an array as its result. Invoked with (item, callback). | ||
60 | + * @param {Function} [callback] - A callback which is called after all the | ||
61 | + * `iteratee` functions have finished, or an error occurs. Results is an array | ||
62 | + * containing the concatenated results of the `iteratee` function. Invoked with | ||
63 | + * (err, results). | ||
64 | + */ | ||
65 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/concatSeries.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _doLimit = require('./internal/doLimit'); | ||
8 | + | ||
9 | +var _doLimit2 = _interopRequireDefault(_doLimit); | ||
10 | + | ||
11 | +var _concatLimit = require('./concatLimit'); | ||
12 | + | ||
13 | +var _concatLimit2 = _interopRequireDefault(_concatLimit); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * The same as [`concat`]{@link module:Collections.concat} but runs only a single async operation at a time. | ||
19 | + * | ||
20 | + * @name concatSeries | ||
21 | + * @static | ||
22 | + * @memberOf module:Collections | ||
23 | + * @method | ||
24 | + * @see [async.concat]{@link module:Collections.concat} | ||
25 | + * @category Collection | ||
26 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
27 | + * @param {AsyncFunction} iteratee - A function to apply to each item in `coll`. | ||
28 | + * The iteratee should complete with an array an array of results. | ||
29 | + * Invoked with (item, callback). | ||
30 | + * @param {Function} [callback(err)] - A callback which is called after all the | ||
31 | + * `iteratee` functions have finished, or an error occurs. Results is an array | ||
32 | + * containing the concatenated results of the `iteratee` function. Invoked with | ||
33 | + * (err, results). | ||
34 | + */ | ||
35 | +exports.default = (0, _doLimit2.default)(_concatLimit2.default, 1); | ||
36 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/constant.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +exports.default = function () /*...values*/{ | ||
8 | + var values = (0, _slice2.default)(arguments); | ||
9 | + var args = [null].concat(values); | ||
10 | + return function () /*...ignoredArgs, callback*/{ | ||
11 | + var callback = arguments[arguments.length - 1]; | ||
12 | + return callback.apply(this, args); | ||
13 | + }; | ||
14 | +}; | ||
15 | + | ||
16 | +var _slice = require('./internal/slice'); | ||
17 | + | ||
18 | +var _slice2 = _interopRequireDefault(_slice); | ||
19 | + | ||
20 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
21 | + | ||
22 | +; | ||
23 | + | ||
24 | +/** | ||
25 | + * Returns a function that when called, calls-back with the values provided. | ||
26 | + * Useful as the first function in a [`waterfall`]{@link module:ControlFlow.waterfall}, or for plugging values in to | ||
27 | + * [`auto`]{@link module:ControlFlow.auto}. | ||
28 | + * | ||
29 | + * @name constant | ||
30 | + * @static | ||
31 | + * @memberOf module:Utils | ||
32 | + * @method | ||
33 | + * @category Util | ||
34 | + * @param {...*} arguments... - Any number of arguments to automatically invoke | ||
35 | + * callback with. | ||
36 | + * @returns {AsyncFunction} Returns a function that when invoked, automatically | ||
37 | + * invokes the callback with the previous given arguments. | ||
38 | + * @example | ||
39 | + * | ||
40 | + * async.waterfall([ | ||
41 | + * async.constant(42), | ||
42 | + * function (value, next) { | ||
43 | + * // value === 42 | ||
44 | + * }, | ||
45 | + * //... | ||
46 | + * ], callback); | ||
47 | + * | ||
48 | + * async.waterfall([ | ||
49 | + * async.constant(filename, "utf8"), | ||
50 | + * fs.readFile, | ||
51 | + * function (fileData, next) { | ||
52 | + * //... | ||
53 | + * } | ||
54 | + * //... | ||
55 | + * ], callback); | ||
56 | + * | ||
57 | + * async.auto({ | ||
58 | + * hostname: async.constant("https://server.net/"), | ||
59 | + * port: findFreePort, | ||
60 | + * launchServer: ["hostname", "port", function (options, cb) { | ||
61 | + * startServer(options, cb); | ||
62 | + * }], | ||
63 | + * //... | ||
64 | + * }, callback); | ||
65 | + */ | ||
66 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/detect.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _identity = require('lodash/identity'); | ||
8 | + | ||
9 | +var _identity2 = _interopRequireDefault(_identity); | ||
10 | + | ||
11 | +var _createTester = require('./internal/createTester'); | ||
12 | + | ||
13 | +var _createTester2 = _interopRequireDefault(_createTester); | ||
14 | + | ||
15 | +var _doParallel = require('./internal/doParallel'); | ||
16 | + | ||
17 | +var _doParallel2 = _interopRequireDefault(_doParallel); | ||
18 | + | ||
19 | +var _findGetResult = require('./internal/findGetResult'); | ||
20 | + | ||
21 | +var _findGetResult2 = _interopRequireDefault(_findGetResult); | ||
22 | + | ||
23 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
24 | + | ||
25 | +/** | ||
26 | + * Returns the first value in `coll` that passes an async truth test. The | ||
27 | + * `iteratee` is applied in parallel, meaning the first iteratee to return | ||
28 | + * `true` will fire the detect `callback` with that result. That means the | ||
29 | + * result might not be the first item in the original `coll` (in terms of order) | ||
30 | + * that passes the test. | ||
31 | + | ||
32 | + * If order within the original `coll` is important, then look at | ||
33 | + * [`detectSeries`]{@link module:Collections.detectSeries}. | ||
34 | + * | ||
35 | + * @name detect | ||
36 | + * @static | ||
37 | + * @memberOf module:Collections | ||
38 | + * @method | ||
39 | + * @alias find | ||
40 | + * @category Collections | ||
41 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
42 | + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. | ||
43 | + * The iteratee must complete with a boolean value as its result. | ||
44 | + * Invoked with (item, callback). | ||
45 | + * @param {Function} [callback] - A callback which is called as soon as any | ||
46 | + * iteratee returns `true`, or after all the `iteratee` functions have finished. | ||
47 | + * Result will be the first item in the array that passes the truth test | ||
48 | + * (iteratee) or the value `undefined` if none passed. Invoked with | ||
49 | + * (err, result). | ||
50 | + * @example | ||
51 | + * | ||
52 | + * async.detect(['file1','file2','file3'], function(filePath, callback) { | ||
53 | + * fs.access(filePath, function(err) { | ||
54 | + * callback(null, !err) | ||
55 | + * }); | ||
56 | + * }, function(err, result) { | ||
57 | + * // result now equals the first file in the list that exists | ||
58 | + * }); | ||
59 | + */ | ||
60 | +exports.default = (0, _doParallel2.default)((0, _createTester2.default)(_identity2.default, _findGetResult2.default)); | ||
61 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/detectLimit.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _identity = require('lodash/identity'); | ||
8 | + | ||
9 | +var _identity2 = _interopRequireDefault(_identity); | ||
10 | + | ||
11 | +var _createTester = require('./internal/createTester'); | ||
12 | + | ||
13 | +var _createTester2 = _interopRequireDefault(_createTester); | ||
14 | + | ||
15 | +var _doParallelLimit = require('./internal/doParallelLimit'); | ||
16 | + | ||
17 | +var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit); | ||
18 | + | ||
19 | +var _findGetResult = require('./internal/findGetResult'); | ||
20 | + | ||
21 | +var _findGetResult2 = _interopRequireDefault(_findGetResult); | ||
22 | + | ||
23 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
24 | + | ||
25 | +/** | ||
26 | + * The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a | ||
27 | + * time. | ||
28 | + * | ||
29 | + * @name detectLimit | ||
30 | + * @static | ||
31 | + * @memberOf module:Collections | ||
32 | + * @method | ||
33 | + * @see [async.detect]{@link module:Collections.detect} | ||
34 | + * @alias findLimit | ||
35 | + * @category Collections | ||
36 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
37 | + * @param {number} limit - The maximum number of async operations at a time. | ||
38 | + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. | ||
39 | + * The iteratee must complete with a boolean value as its result. | ||
40 | + * Invoked with (item, callback). | ||
41 | + * @param {Function} [callback] - A callback which is called as soon as any | ||
42 | + * iteratee returns `true`, or after all the `iteratee` functions have finished. | ||
43 | + * Result will be the first item in the array that passes the truth test | ||
44 | + * (iteratee) or the value `undefined` if none passed. Invoked with | ||
45 | + * (err, result). | ||
46 | + */ | ||
47 | +exports.default = (0, _doParallelLimit2.default)((0, _createTester2.default)(_identity2.default, _findGetResult2.default)); | ||
48 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/detectSeries.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _detectLimit = require('./detectLimit'); | ||
8 | + | ||
9 | +var _detectLimit2 = _interopRequireDefault(_detectLimit); | ||
10 | + | ||
11 | +var _doLimit = require('./internal/doLimit'); | ||
12 | + | ||
13 | +var _doLimit2 = _interopRequireDefault(_doLimit); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time. | ||
19 | + * | ||
20 | + * @name detectSeries | ||
21 | + * @static | ||
22 | + * @memberOf module:Collections | ||
23 | + * @method | ||
24 | + * @see [async.detect]{@link module:Collections.detect} | ||
25 | + * @alias findSeries | ||
26 | + * @category Collections | ||
27 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
28 | + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. | ||
29 | + * The iteratee must complete with a boolean value as its result. | ||
30 | + * Invoked with (item, callback). | ||
31 | + * @param {Function} [callback] - A callback which is called as soon as any | ||
32 | + * iteratee returns `true`, or after all the `iteratee` functions have finished. | ||
33 | + * Result will be the first item in the array that passes the truth test | ||
34 | + * (iteratee) or the value `undefined` if none passed. Invoked with | ||
35 | + * (err, result). | ||
36 | + */ | ||
37 | +exports.default = (0, _doLimit2.default)(_detectLimit2.default, 1); | ||
38 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/dir.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _consoleFunc = require('./internal/consoleFunc'); | ||
8 | + | ||
9 | +var _consoleFunc2 = _interopRequireDefault(_consoleFunc); | ||
10 | + | ||
11 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
12 | + | ||
13 | +/** | ||
14 | + * Logs the result of an [`async` function]{@link AsyncFunction} to the | ||
15 | + * `console` using `console.dir` to display the properties of the resulting object. | ||
16 | + * Only works in Node.js or in browsers that support `console.dir` and | ||
17 | + * `console.error` (such as FF and Chrome). | ||
18 | + * If multiple arguments are returned from the async function, | ||
19 | + * `console.dir` is called on each argument in order. | ||
20 | + * | ||
21 | + * @name dir | ||
22 | + * @static | ||
23 | + * @memberOf module:Utils | ||
24 | + * @method | ||
25 | + * @category Util | ||
26 | + * @param {AsyncFunction} function - The function you want to eventually apply | ||
27 | + * all arguments to. | ||
28 | + * @param {...*} arguments... - Any number of arguments to apply to the function. | ||
29 | + * @example | ||
30 | + * | ||
31 | + * // in a module | ||
32 | + * var hello = function(name, callback) { | ||
33 | + * setTimeout(function() { | ||
34 | + * callback(null, {hello: name}); | ||
35 | + * }, 1000); | ||
36 | + * }; | ||
37 | + * | ||
38 | + * // in the node repl | ||
39 | + * node> async.dir(hello, 'world'); | ||
40 | + * {hello: 'world'} | ||
41 | + */ | ||
42 | +exports.default = (0, _consoleFunc2.default)('dir'); | ||
43 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/dist/async.js
0 → 100644
This diff could not be displayed because it is too large.
node_modules/async/dist/async.min.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/dist/async.min.map
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/doDuring.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = doDuring; | ||
7 | + | ||
8 | +var _noop = require('lodash/noop'); | ||
9 | + | ||
10 | +var _noop2 = _interopRequireDefault(_noop); | ||
11 | + | ||
12 | +var _slice = require('./internal/slice'); | ||
13 | + | ||
14 | +var _slice2 = _interopRequireDefault(_slice); | ||
15 | + | ||
16 | +var _onlyOnce = require('./internal/onlyOnce'); | ||
17 | + | ||
18 | +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); | ||
19 | + | ||
20 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
21 | + | ||
22 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
23 | + | ||
24 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
25 | + | ||
26 | +/** | ||
27 | + * The post-check version of [`during`]{@link module:ControlFlow.during}. To reflect the difference in | ||
28 | + * the order of operations, the arguments `test` and `fn` are switched. | ||
29 | + * | ||
30 | + * Also a version of [`doWhilst`]{@link module:ControlFlow.doWhilst} with asynchronous `test` function. | ||
31 | + * @name doDuring | ||
32 | + * @static | ||
33 | + * @memberOf module:ControlFlow | ||
34 | + * @method | ||
35 | + * @see [async.during]{@link module:ControlFlow.during} | ||
36 | + * @category Control Flow | ||
37 | + * @param {AsyncFunction} fn - An async function which is called each time | ||
38 | + * `test` passes. Invoked with (callback). | ||
39 | + * @param {AsyncFunction} test - asynchronous truth test to perform before each | ||
40 | + * execution of `fn`. Invoked with (...args, callback), where `...args` are the | ||
41 | + * non-error args from the previous callback of `fn`. | ||
42 | + * @param {Function} [callback] - A callback which is called after the test | ||
43 | + * function has failed and repeated execution of `fn` has stopped. `callback` | ||
44 | + * will be passed an error if one occurred, otherwise `null`. | ||
45 | + */ | ||
46 | +function doDuring(fn, test, callback) { | ||
47 | + callback = (0, _onlyOnce2.default)(callback || _noop2.default); | ||
48 | + var _fn = (0, _wrapAsync2.default)(fn); | ||
49 | + var _test = (0, _wrapAsync2.default)(test); | ||
50 | + | ||
51 | + function next(err /*, ...args*/) { | ||
52 | + if (err) return callback(err); | ||
53 | + var args = (0, _slice2.default)(arguments, 1); | ||
54 | + args.push(check); | ||
55 | + _test.apply(this, args); | ||
56 | + }; | ||
57 | + | ||
58 | + function check(err, truth) { | ||
59 | + if (err) return callback(err); | ||
60 | + if (!truth) return callback(null); | ||
61 | + _fn(next); | ||
62 | + } | ||
63 | + | ||
64 | + check(null, true); | ||
65 | +} | ||
66 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/doUntil.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = doUntil; | ||
7 | + | ||
8 | +var _doWhilst = require('./doWhilst'); | ||
9 | + | ||
10 | +var _doWhilst2 = _interopRequireDefault(_doWhilst); | ||
11 | + | ||
12 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
13 | + | ||
14 | +/** | ||
15 | + * Like ['doWhilst']{@link module:ControlFlow.doWhilst}, except the `test` is inverted. Note the | ||
16 | + * argument ordering differs from `until`. | ||
17 | + * | ||
18 | + * @name doUntil | ||
19 | + * @static | ||
20 | + * @memberOf module:ControlFlow | ||
21 | + * @method | ||
22 | + * @see [async.doWhilst]{@link module:ControlFlow.doWhilst} | ||
23 | + * @category Control Flow | ||
24 | + * @param {AsyncFunction} iteratee - An async function which is called each time | ||
25 | + * `test` fails. Invoked with (callback). | ||
26 | + * @param {Function} test - synchronous truth test to perform after each | ||
27 | + * execution of `iteratee`. Invoked with any non-error callback results of | ||
28 | + * `iteratee`. | ||
29 | + * @param {Function} [callback] - A callback which is called after the test | ||
30 | + * function has passed and repeated execution of `iteratee` has stopped. `callback` | ||
31 | + * will be passed an error and any arguments passed to the final `iteratee`'s | ||
32 | + * callback. Invoked with (err, [results]); | ||
33 | + */ | ||
34 | +function doUntil(iteratee, test, callback) { | ||
35 | + (0, _doWhilst2.default)(iteratee, function () { | ||
36 | + return !test.apply(this, arguments); | ||
37 | + }, callback); | ||
38 | +} | ||
39 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/doWhilst.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = doWhilst; | ||
7 | + | ||
8 | +var _noop = require('lodash/noop'); | ||
9 | + | ||
10 | +var _noop2 = _interopRequireDefault(_noop); | ||
11 | + | ||
12 | +var _slice = require('./internal/slice'); | ||
13 | + | ||
14 | +var _slice2 = _interopRequireDefault(_slice); | ||
15 | + | ||
16 | +var _onlyOnce = require('./internal/onlyOnce'); | ||
17 | + | ||
18 | +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); | ||
19 | + | ||
20 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
21 | + | ||
22 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
23 | + | ||
24 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
25 | + | ||
26 | +/** | ||
27 | + * The post-check version of [`whilst`]{@link module:ControlFlow.whilst}. To reflect the difference in | ||
28 | + * the order of operations, the arguments `test` and `iteratee` are switched. | ||
29 | + * | ||
30 | + * `doWhilst` is to `whilst` as `do while` is to `while` in plain JavaScript. | ||
31 | + * | ||
32 | + * @name doWhilst | ||
33 | + * @static | ||
34 | + * @memberOf module:ControlFlow | ||
35 | + * @method | ||
36 | + * @see [async.whilst]{@link module:ControlFlow.whilst} | ||
37 | + * @category Control Flow | ||
38 | + * @param {AsyncFunction} iteratee - A function which is called each time `test` | ||
39 | + * passes. Invoked with (callback). | ||
40 | + * @param {Function} test - synchronous truth test to perform after each | ||
41 | + * execution of `iteratee`. Invoked with any non-error callback results of | ||
42 | + * `iteratee`. | ||
43 | + * @param {Function} [callback] - A callback which is called after the test | ||
44 | + * function has failed and repeated execution of `iteratee` has stopped. | ||
45 | + * `callback` will be passed an error and any arguments passed to the final | ||
46 | + * `iteratee`'s callback. Invoked with (err, [results]); | ||
47 | + */ | ||
48 | +function doWhilst(iteratee, test, callback) { | ||
49 | + callback = (0, _onlyOnce2.default)(callback || _noop2.default); | ||
50 | + var _iteratee = (0, _wrapAsync2.default)(iteratee); | ||
51 | + var next = function (err /*, ...args*/) { | ||
52 | + if (err) return callback(err); | ||
53 | + var args = (0, _slice2.default)(arguments, 1); | ||
54 | + if (test.apply(this, args)) return _iteratee(next); | ||
55 | + callback.apply(null, [null].concat(args)); | ||
56 | + }; | ||
57 | + _iteratee(next); | ||
58 | +} | ||
59 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/during.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = during; | ||
7 | + | ||
8 | +var _noop = require('lodash/noop'); | ||
9 | + | ||
10 | +var _noop2 = _interopRequireDefault(_noop); | ||
11 | + | ||
12 | +var _onlyOnce = require('./internal/onlyOnce'); | ||
13 | + | ||
14 | +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); | ||
15 | + | ||
16 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
17 | + | ||
18 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
19 | + | ||
20 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
21 | + | ||
22 | +/** | ||
23 | + * Like [`whilst`]{@link module:ControlFlow.whilst}, except the `test` is an asynchronous function that | ||
24 | + * is passed a callback in the form of `function (err, truth)`. If error is | ||
25 | + * passed to `test` or `fn`, the main callback is immediately called with the | ||
26 | + * value of the error. | ||
27 | + * | ||
28 | + * @name during | ||
29 | + * @static | ||
30 | + * @memberOf module:ControlFlow | ||
31 | + * @method | ||
32 | + * @see [async.whilst]{@link module:ControlFlow.whilst} | ||
33 | + * @category Control Flow | ||
34 | + * @param {AsyncFunction} test - asynchronous truth test to perform before each | ||
35 | + * execution of `fn`. Invoked with (callback). | ||
36 | + * @param {AsyncFunction} fn - An async function which is called each time | ||
37 | + * `test` passes. Invoked with (callback). | ||
38 | + * @param {Function} [callback] - A callback which is called after the test | ||
39 | + * function has failed and repeated execution of `fn` has stopped. `callback` | ||
40 | + * will be passed an error, if one occurred, otherwise `null`. | ||
41 | + * @example | ||
42 | + * | ||
43 | + * var count = 0; | ||
44 | + * | ||
45 | + * async.during( | ||
46 | + * function (callback) { | ||
47 | + * return callback(null, count < 5); | ||
48 | + * }, | ||
49 | + * function (callback) { | ||
50 | + * count++; | ||
51 | + * setTimeout(callback, 1000); | ||
52 | + * }, | ||
53 | + * function (err) { | ||
54 | + * // 5 seconds have passed | ||
55 | + * } | ||
56 | + * ); | ||
57 | + */ | ||
58 | +function during(test, fn, callback) { | ||
59 | + callback = (0, _onlyOnce2.default)(callback || _noop2.default); | ||
60 | + var _fn = (0, _wrapAsync2.default)(fn); | ||
61 | + var _test = (0, _wrapAsync2.default)(test); | ||
62 | + | ||
63 | + function next(err) { | ||
64 | + if (err) return callback(err); | ||
65 | + _test(check); | ||
66 | + } | ||
67 | + | ||
68 | + function check(err, truth) { | ||
69 | + if (err) return callback(err); | ||
70 | + if (!truth) return callback(null); | ||
71 | + _fn(next); | ||
72 | + } | ||
73 | + | ||
74 | + _test(check); | ||
75 | +} | ||
76 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/each.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = eachLimit; | ||
7 | + | ||
8 | +var _eachOf = require('./eachOf'); | ||
9 | + | ||
10 | +var _eachOf2 = _interopRequireDefault(_eachOf); | ||
11 | + | ||
12 | +var _withoutIndex = require('./internal/withoutIndex'); | ||
13 | + | ||
14 | +var _withoutIndex2 = _interopRequireDefault(_withoutIndex); | ||
15 | + | ||
16 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
17 | + | ||
18 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
19 | + | ||
20 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
21 | + | ||
22 | +/** | ||
23 | + * Applies the function `iteratee` to each item in `coll`, in parallel. | ||
24 | + * The `iteratee` is called with an item from the list, and a callback for when | ||
25 | + * it has finished. If the `iteratee` passes an error to its `callback`, the | ||
26 | + * main `callback` (for the `each` function) is immediately called with the | ||
27 | + * error. | ||
28 | + * | ||
29 | + * Note, that since this function applies `iteratee` to each item in parallel, | ||
30 | + * there is no guarantee that the iteratee functions will complete in order. | ||
31 | + * | ||
32 | + * @name each | ||
33 | + * @static | ||
34 | + * @memberOf module:Collections | ||
35 | + * @method | ||
36 | + * @alias forEach | ||
37 | + * @category Collection | ||
38 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
39 | + * @param {AsyncFunction} iteratee - An async function to apply to | ||
40 | + * each item in `coll`. Invoked with (item, callback). | ||
41 | + * The array index is not passed to the iteratee. | ||
42 | + * If you need the index, use `eachOf`. | ||
43 | + * @param {Function} [callback] - A callback which is called when all | ||
44 | + * `iteratee` functions have finished, or an error occurs. Invoked with (err). | ||
45 | + * @example | ||
46 | + * | ||
47 | + * // assuming openFiles is an array of file names and saveFile is a function | ||
48 | + * // to save the modified contents of that file: | ||
49 | + * | ||
50 | + * async.each(openFiles, saveFile, function(err){ | ||
51 | + * // if any of the saves produced an error, err would equal that error | ||
52 | + * }); | ||
53 | + * | ||
54 | + * // assuming openFiles is an array of file names | ||
55 | + * async.each(openFiles, function(file, callback) { | ||
56 | + * | ||
57 | + * // Perform operation on file here. | ||
58 | + * console.log('Processing file ' + file); | ||
59 | + * | ||
60 | + * if( file.length > 32 ) { | ||
61 | + * console.log('This file name is too long'); | ||
62 | + * callback('File name too long'); | ||
63 | + * } else { | ||
64 | + * // Do work to process file here | ||
65 | + * console.log('File processed'); | ||
66 | + * callback(); | ||
67 | + * } | ||
68 | + * }, function(err) { | ||
69 | + * // if any of the file processing produced an error, err would equal that error | ||
70 | + * if( err ) { | ||
71 | + * // One of the iterations produced an error. | ||
72 | + * // All processing will now stop. | ||
73 | + * console.log('A file failed to process'); | ||
74 | + * } else { | ||
75 | + * console.log('All files have been processed successfully'); | ||
76 | + * } | ||
77 | + * }); | ||
78 | + */ | ||
79 | +function eachLimit(coll, iteratee, callback) { | ||
80 | + (0, _eachOf2.default)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback); | ||
81 | +} | ||
82 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/eachLimit.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = eachLimit; | ||
7 | + | ||
8 | +var _eachOfLimit = require('./internal/eachOfLimit'); | ||
9 | + | ||
10 | +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); | ||
11 | + | ||
12 | +var _withoutIndex = require('./internal/withoutIndex'); | ||
13 | + | ||
14 | +var _withoutIndex2 = _interopRequireDefault(_withoutIndex); | ||
15 | + | ||
16 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
17 | + | ||
18 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
19 | + | ||
20 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
21 | + | ||
22 | +/** | ||
23 | + * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time. | ||
24 | + * | ||
25 | + * @name eachLimit | ||
26 | + * @static | ||
27 | + * @memberOf module:Collections | ||
28 | + * @method | ||
29 | + * @see [async.each]{@link module:Collections.each} | ||
30 | + * @alias forEachLimit | ||
31 | + * @category Collection | ||
32 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
33 | + * @param {number} limit - The maximum number of async operations at a time. | ||
34 | + * @param {AsyncFunction} iteratee - An async function to apply to each item in | ||
35 | + * `coll`. | ||
36 | + * The array index is not passed to the iteratee. | ||
37 | + * If you need the index, use `eachOfLimit`. | ||
38 | + * Invoked with (item, callback). | ||
39 | + * @param {Function} [callback] - A callback which is called when all | ||
40 | + * `iteratee` functions have finished, or an error occurs. Invoked with (err). | ||
41 | + */ | ||
42 | +function eachLimit(coll, limit, iteratee, callback) { | ||
43 | + (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback); | ||
44 | +} | ||
45 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/eachOf.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +exports.default = function (coll, iteratee, callback) { | ||
8 | + var eachOfImplementation = (0, _isArrayLike2.default)(coll) ? eachOfArrayLike : eachOfGeneric; | ||
9 | + eachOfImplementation(coll, (0, _wrapAsync2.default)(iteratee), callback); | ||
10 | +}; | ||
11 | + | ||
12 | +var _isArrayLike = require('lodash/isArrayLike'); | ||
13 | + | ||
14 | +var _isArrayLike2 = _interopRequireDefault(_isArrayLike); | ||
15 | + | ||
16 | +var _breakLoop = require('./internal/breakLoop'); | ||
17 | + | ||
18 | +var _breakLoop2 = _interopRequireDefault(_breakLoop); | ||
19 | + | ||
20 | +var _eachOfLimit = require('./eachOfLimit'); | ||
21 | + | ||
22 | +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); | ||
23 | + | ||
24 | +var _doLimit = require('./internal/doLimit'); | ||
25 | + | ||
26 | +var _doLimit2 = _interopRequireDefault(_doLimit); | ||
27 | + | ||
28 | +var _noop = require('lodash/noop'); | ||
29 | + | ||
30 | +var _noop2 = _interopRequireDefault(_noop); | ||
31 | + | ||
32 | +var _once = require('./internal/once'); | ||
33 | + | ||
34 | +var _once2 = _interopRequireDefault(_once); | ||
35 | + | ||
36 | +var _onlyOnce = require('./internal/onlyOnce'); | ||
37 | + | ||
38 | +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); | ||
39 | + | ||
40 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
41 | + | ||
42 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
43 | + | ||
44 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
45 | + | ||
46 | +// eachOf implementation optimized for array-likes | ||
47 | +function eachOfArrayLike(coll, iteratee, callback) { | ||
48 | + callback = (0, _once2.default)(callback || _noop2.default); | ||
49 | + var index = 0, | ||
50 | + completed = 0, | ||
51 | + length = coll.length; | ||
52 | + if (length === 0) { | ||
53 | + callback(null); | ||
54 | + } | ||
55 | + | ||
56 | + function iteratorCallback(err, value) { | ||
57 | + if (err) { | ||
58 | + callback(err); | ||
59 | + } else if (++completed === length || value === _breakLoop2.default) { | ||
60 | + callback(null); | ||
61 | + } | ||
62 | + } | ||
63 | + | ||
64 | + for (; index < length; index++) { | ||
65 | + iteratee(coll[index], index, (0, _onlyOnce2.default)(iteratorCallback)); | ||
66 | + } | ||
67 | +} | ||
68 | + | ||
69 | +// a generic version of eachOf which can handle array, object, and iterator cases. | ||
70 | +var eachOfGeneric = (0, _doLimit2.default)(_eachOfLimit2.default, Infinity); | ||
71 | + | ||
72 | +/** | ||
73 | + * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument | ||
74 | + * to the iteratee. | ||
75 | + * | ||
76 | + * @name eachOf | ||
77 | + * @static | ||
78 | + * @memberOf module:Collections | ||
79 | + * @method | ||
80 | + * @alias forEachOf | ||
81 | + * @category Collection | ||
82 | + * @see [async.each]{@link module:Collections.each} | ||
83 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
84 | + * @param {AsyncFunction} iteratee - A function to apply to each | ||
85 | + * item in `coll`. | ||
86 | + * The `key` is the item's key, or index in the case of an array. | ||
87 | + * Invoked with (item, key, callback). | ||
88 | + * @param {Function} [callback] - A callback which is called when all | ||
89 | + * `iteratee` functions have finished, or an error occurs. Invoked with (err). | ||
90 | + * @example | ||
91 | + * | ||
92 | + * var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; | ||
93 | + * var configs = {}; | ||
94 | + * | ||
95 | + * async.forEachOf(obj, function (value, key, callback) { | ||
96 | + * fs.readFile(__dirname + value, "utf8", function (err, data) { | ||
97 | + * if (err) return callback(err); | ||
98 | + * try { | ||
99 | + * configs[key] = JSON.parse(data); | ||
100 | + * } catch (e) { | ||
101 | + * return callback(e); | ||
102 | + * } | ||
103 | + * callback(); | ||
104 | + * }); | ||
105 | + * }, function (err) { | ||
106 | + * if (err) console.error(err.message); | ||
107 | + * // configs is now a map of JSON data | ||
108 | + * doSomethingWith(configs); | ||
109 | + * }); | ||
110 | + */ | ||
111 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/eachOfLimit.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = eachOfLimit; | ||
7 | + | ||
8 | +var _eachOfLimit2 = require('./internal/eachOfLimit'); | ||
9 | + | ||
10 | +var _eachOfLimit3 = _interopRequireDefault(_eachOfLimit2); | ||
11 | + | ||
12 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
13 | + | ||
14 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
15 | + | ||
16 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
17 | + | ||
18 | +/** | ||
19 | + * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a | ||
20 | + * time. | ||
21 | + * | ||
22 | + * @name eachOfLimit | ||
23 | + * @static | ||
24 | + * @memberOf module:Collections | ||
25 | + * @method | ||
26 | + * @see [async.eachOf]{@link module:Collections.eachOf} | ||
27 | + * @alias forEachOfLimit | ||
28 | + * @category Collection | ||
29 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
30 | + * @param {number} limit - The maximum number of async operations at a time. | ||
31 | + * @param {AsyncFunction} iteratee - An async function to apply to each | ||
32 | + * item in `coll`. The `key` is the item's key, or index in the case of an | ||
33 | + * array. | ||
34 | + * Invoked with (item, key, callback). | ||
35 | + * @param {Function} [callback] - A callback which is called when all | ||
36 | + * `iteratee` functions have finished, or an error occurs. Invoked with (err). | ||
37 | + */ | ||
38 | +function eachOfLimit(coll, limit, iteratee, callback) { | ||
39 | + (0, _eachOfLimit3.default)(limit)(coll, (0, _wrapAsync2.default)(iteratee), callback); | ||
40 | +} | ||
41 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/eachOfSeries.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _eachOfLimit = require('./eachOfLimit'); | ||
8 | + | ||
9 | +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); | ||
10 | + | ||
11 | +var _doLimit = require('./internal/doLimit'); | ||
12 | + | ||
13 | +var _doLimit2 = _interopRequireDefault(_doLimit); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time. | ||
19 | + * | ||
20 | + * @name eachOfSeries | ||
21 | + * @static | ||
22 | + * @memberOf module:Collections | ||
23 | + * @method | ||
24 | + * @see [async.eachOf]{@link module:Collections.eachOf} | ||
25 | + * @alias forEachOfSeries | ||
26 | + * @category Collection | ||
27 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
28 | + * @param {AsyncFunction} iteratee - An async function to apply to each item in | ||
29 | + * `coll`. | ||
30 | + * Invoked with (item, key, callback). | ||
31 | + * @param {Function} [callback] - A callback which is called when all `iteratee` | ||
32 | + * functions have finished, or an error occurs. Invoked with (err). | ||
33 | + */ | ||
34 | +exports.default = (0, _doLimit2.default)(_eachOfLimit2.default, 1); | ||
35 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/eachSeries.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _eachLimit = require('./eachLimit'); | ||
8 | + | ||
9 | +var _eachLimit2 = _interopRequireDefault(_eachLimit); | ||
10 | + | ||
11 | +var _doLimit = require('./internal/doLimit'); | ||
12 | + | ||
13 | +var _doLimit2 = _interopRequireDefault(_doLimit); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time. | ||
19 | + * | ||
20 | + * @name eachSeries | ||
21 | + * @static | ||
22 | + * @memberOf module:Collections | ||
23 | + * @method | ||
24 | + * @see [async.each]{@link module:Collections.each} | ||
25 | + * @alias forEachSeries | ||
26 | + * @category Collection | ||
27 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
28 | + * @param {AsyncFunction} iteratee - An async function to apply to each | ||
29 | + * item in `coll`. | ||
30 | + * The array index is not passed to the iteratee. | ||
31 | + * If you need the index, use `eachOfSeries`. | ||
32 | + * Invoked with (item, callback). | ||
33 | + * @param {Function} [callback] - A callback which is called when all | ||
34 | + * `iteratee` functions have finished, or an error occurs. Invoked with (err). | ||
35 | + */ | ||
36 | +exports.default = (0, _doLimit2.default)(_eachLimit2.default, 1); | ||
37 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/ensureAsync.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = ensureAsync; | ||
7 | + | ||
8 | +var _setImmediate = require('./internal/setImmediate'); | ||
9 | + | ||
10 | +var _setImmediate2 = _interopRequireDefault(_setImmediate); | ||
11 | + | ||
12 | +var _initialParams = require('./internal/initialParams'); | ||
13 | + | ||
14 | +var _initialParams2 = _interopRequireDefault(_initialParams); | ||
15 | + | ||
16 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
17 | + | ||
18 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
19 | + | ||
20 | +/** | ||
21 | + * Wrap an async function and ensure it calls its callback on a later tick of | ||
22 | + * the event loop. If the function already calls its callback on a next tick, | ||
23 | + * no extra deferral is added. This is useful for preventing stack overflows | ||
24 | + * (`RangeError: Maximum call stack size exceeded`) and generally keeping | ||
25 | + * [Zalgo](http://blog.izs.me/post/59142742143/designing-apis-for-asynchrony) | ||
26 | + * contained. ES2017 `async` functions are returned as-is -- they are immune | ||
27 | + * to Zalgo's corrupting influences, as they always resolve on a later tick. | ||
28 | + * | ||
29 | + * @name ensureAsync | ||
30 | + * @static | ||
31 | + * @memberOf module:Utils | ||
32 | + * @method | ||
33 | + * @category Util | ||
34 | + * @param {AsyncFunction} fn - an async function, one that expects a node-style | ||
35 | + * callback as its last argument. | ||
36 | + * @returns {AsyncFunction} Returns a wrapped function with the exact same call | ||
37 | + * signature as the function passed in. | ||
38 | + * @example | ||
39 | + * | ||
40 | + * function sometimesAsync(arg, callback) { | ||
41 | + * if (cache[arg]) { | ||
42 | + * return callback(null, cache[arg]); // this would be synchronous!! | ||
43 | + * } else { | ||
44 | + * doSomeIO(arg, callback); // this IO would be asynchronous | ||
45 | + * } | ||
46 | + * } | ||
47 | + * | ||
48 | + * // this has a risk of stack overflows if many results are cached in a row | ||
49 | + * async.mapSeries(args, sometimesAsync, done); | ||
50 | + * | ||
51 | + * // this will defer sometimesAsync's callback if necessary, | ||
52 | + * // preventing stack overflows | ||
53 | + * async.mapSeries(args, async.ensureAsync(sometimesAsync), done); | ||
54 | + */ | ||
55 | +function ensureAsync(fn) { | ||
56 | + if ((0, _wrapAsync.isAsync)(fn)) return fn; | ||
57 | + return (0, _initialParams2.default)(function (args, callback) { | ||
58 | + var sync = true; | ||
59 | + args.push(function () { | ||
60 | + var innerArgs = arguments; | ||
61 | + if (sync) { | ||
62 | + (0, _setImmediate2.default)(function () { | ||
63 | + callback.apply(null, innerArgs); | ||
64 | + }); | ||
65 | + } else { | ||
66 | + callback.apply(null, innerArgs); | ||
67 | + } | ||
68 | + }); | ||
69 | + fn.apply(this, args); | ||
70 | + sync = false; | ||
71 | + }); | ||
72 | +} | ||
73 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/every.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _createTester = require('./internal/createTester'); | ||
8 | + | ||
9 | +var _createTester2 = _interopRequireDefault(_createTester); | ||
10 | + | ||
11 | +var _doParallel = require('./internal/doParallel'); | ||
12 | + | ||
13 | +var _doParallel2 = _interopRequireDefault(_doParallel); | ||
14 | + | ||
15 | +var _notId = require('./internal/notId'); | ||
16 | + | ||
17 | +var _notId2 = _interopRequireDefault(_notId); | ||
18 | + | ||
19 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
20 | + | ||
21 | +/** | ||
22 | + * Returns `true` if every element in `coll` satisfies an async test. If any | ||
23 | + * iteratee call returns `false`, the main `callback` is immediately called. | ||
24 | + * | ||
25 | + * @name every | ||
26 | + * @static | ||
27 | + * @memberOf module:Collections | ||
28 | + * @method | ||
29 | + * @alias all | ||
30 | + * @category Collection | ||
31 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
32 | + * @param {AsyncFunction} iteratee - An async truth test to apply to each item | ||
33 | + * in the collection in parallel. | ||
34 | + * The iteratee must complete with a boolean result value. | ||
35 | + * Invoked with (item, callback). | ||
36 | + * @param {Function} [callback] - A callback which is called after all the | ||
37 | + * `iteratee` functions have finished. Result will be either `true` or `false` | ||
38 | + * depending on the values of the async tests. Invoked with (err, result). | ||
39 | + * @example | ||
40 | + * | ||
41 | + * async.every(['file1','file2','file3'], function(filePath, callback) { | ||
42 | + * fs.access(filePath, function(err) { | ||
43 | + * callback(null, !err) | ||
44 | + * }); | ||
45 | + * }, function(err, result) { | ||
46 | + * // if result is true then every file exists | ||
47 | + * }); | ||
48 | + */ | ||
49 | +exports.default = (0, _doParallel2.default)((0, _createTester2.default)(_notId2.default, _notId2.default)); | ||
50 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/everyLimit.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _createTester = require('./internal/createTester'); | ||
8 | + | ||
9 | +var _createTester2 = _interopRequireDefault(_createTester); | ||
10 | + | ||
11 | +var _doParallelLimit = require('./internal/doParallelLimit'); | ||
12 | + | ||
13 | +var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit); | ||
14 | + | ||
15 | +var _notId = require('./internal/notId'); | ||
16 | + | ||
17 | +var _notId2 = _interopRequireDefault(_notId); | ||
18 | + | ||
19 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
20 | + | ||
21 | +/** | ||
22 | + * The same as [`every`]{@link module:Collections.every} but runs a maximum of `limit` async operations at a time. | ||
23 | + * | ||
24 | + * @name everyLimit | ||
25 | + * @static | ||
26 | + * @memberOf module:Collections | ||
27 | + * @method | ||
28 | + * @see [async.every]{@link module:Collections.every} | ||
29 | + * @alias allLimit | ||
30 | + * @category Collection | ||
31 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
32 | + * @param {number} limit - The maximum number of async operations at a time. | ||
33 | + * @param {AsyncFunction} iteratee - An async truth test to apply to each item | ||
34 | + * in the collection in parallel. | ||
35 | + * The iteratee must complete with a boolean result value. | ||
36 | + * Invoked with (item, callback). | ||
37 | + * @param {Function} [callback] - A callback which is called after all the | ||
38 | + * `iteratee` functions have finished. Result will be either `true` or `false` | ||
39 | + * depending on the values of the async tests. Invoked with (err, result). | ||
40 | + */ | ||
41 | +exports.default = (0, _doParallelLimit2.default)((0, _createTester2.default)(_notId2.default, _notId2.default)); | ||
42 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/everySeries.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _everyLimit = require('./everyLimit'); | ||
8 | + | ||
9 | +var _everyLimit2 = _interopRequireDefault(_everyLimit); | ||
10 | + | ||
11 | +var _doLimit = require('./internal/doLimit'); | ||
12 | + | ||
13 | +var _doLimit2 = _interopRequireDefault(_doLimit); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * The same as [`every`]{@link module:Collections.every} but runs only a single async operation at a time. | ||
19 | + * | ||
20 | + * @name everySeries | ||
21 | + * @static | ||
22 | + * @memberOf module:Collections | ||
23 | + * @method | ||
24 | + * @see [async.every]{@link module:Collections.every} | ||
25 | + * @alias allSeries | ||
26 | + * @category Collection | ||
27 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
28 | + * @param {AsyncFunction} iteratee - An async truth test to apply to each item | ||
29 | + * in the collection in series. | ||
30 | + * The iteratee must complete with a boolean result value. | ||
31 | + * Invoked with (item, callback). | ||
32 | + * @param {Function} [callback] - A callback which is called after all the | ||
33 | + * `iteratee` functions have finished. Result will be either `true` or `false` | ||
34 | + * depending on the values of the async tests. Invoked with (err, result). | ||
35 | + */ | ||
36 | +exports.default = (0, _doLimit2.default)(_everyLimit2.default, 1); | ||
37 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/filter.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _filter = require('./internal/filter'); | ||
8 | + | ||
9 | +var _filter2 = _interopRequireDefault(_filter); | ||
10 | + | ||
11 | +var _doParallel = require('./internal/doParallel'); | ||
12 | + | ||
13 | +var _doParallel2 = _interopRequireDefault(_doParallel); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * Returns a new array of all the values in `coll` which pass an async truth | ||
19 | + * test. This operation is performed in parallel, but the results array will be | ||
20 | + * in the same order as the original. | ||
21 | + * | ||
22 | + * @name filter | ||
23 | + * @static | ||
24 | + * @memberOf module:Collections | ||
25 | + * @method | ||
26 | + * @alias select | ||
27 | + * @category Collection | ||
28 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
29 | + * @param {Function} iteratee - A truth test to apply to each item in `coll`. | ||
30 | + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called | ||
31 | + * with a boolean argument once it has completed. Invoked with (item, callback). | ||
32 | + * @param {Function} [callback] - A callback which is called after all the | ||
33 | + * `iteratee` functions have finished. Invoked with (err, results). | ||
34 | + * @example | ||
35 | + * | ||
36 | + * async.filter(['file1','file2','file3'], function(filePath, callback) { | ||
37 | + * fs.access(filePath, function(err) { | ||
38 | + * callback(null, !err) | ||
39 | + * }); | ||
40 | + * }, function(err, results) { | ||
41 | + * // results now equals an array of the existing files | ||
42 | + * }); | ||
43 | + */ | ||
44 | +exports.default = (0, _doParallel2.default)(_filter2.default); | ||
45 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/filterLimit.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _filter = require('./internal/filter'); | ||
8 | + | ||
9 | +var _filter2 = _interopRequireDefault(_filter); | ||
10 | + | ||
11 | +var _doParallelLimit = require('./internal/doParallelLimit'); | ||
12 | + | ||
13 | +var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a | ||
19 | + * time. | ||
20 | + * | ||
21 | + * @name filterLimit | ||
22 | + * @static | ||
23 | + * @memberOf module:Collections | ||
24 | + * @method | ||
25 | + * @see [async.filter]{@link module:Collections.filter} | ||
26 | + * @alias selectLimit | ||
27 | + * @category Collection | ||
28 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
29 | + * @param {number} limit - The maximum number of async operations at a time. | ||
30 | + * @param {Function} iteratee - A truth test to apply to each item in `coll`. | ||
31 | + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called | ||
32 | + * with a boolean argument once it has completed. Invoked with (item, callback). | ||
33 | + * @param {Function} [callback] - A callback which is called after all the | ||
34 | + * `iteratee` functions have finished. Invoked with (err, results). | ||
35 | + */ | ||
36 | +exports.default = (0, _doParallelLimit2.default)(_filter2.default); | ||
37 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/filterSeries.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _filterLimit = require('./filterLimit'); | ||
8 | + | ||
9 | +var _filterLimit2 = _interopRequireDefault(_filterLimit); | ||
10 | + | ||
11 | +var _doLimit = require('./internal/doLimit'); | ||
12 | + | ||
13 | +var _doLimit2 = _interopRequireDefault(_doLimit); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time. | ||
19 | + * | ||
20 | + * @name filterSeries | ||
21 | + * @static | ||
22 | + * @memberOf module:Collections | ||
23 | + * @method | ||
24 | + * @see [async.filter]{@link module:Collections.filter} | ||
25 | + * @alias selectSeries | ||
26 | + * @category Collection | ||
27 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
28 | + * @param {Function} iteratee - A truth test to apply to each item in `coll`. | ||
29 | + * The `iteratee` is passed a `callback(err, truthValue)`, which must be called | ||
30 | + * with a boolean argument once it has completed. Invoked with (item, callback). | ||
31 | + * @param {Function} [callback] - A callback which is called after all the | ||
32 | + * `iteratee` functions have finished. Invoked with (err, results) | ||
33 | + */ | ||
34 | +exports.default = (0, _doLimit2.default)(_filterLimit2.default, 1); | ||
35 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/find.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _identity = require('lodash/identity'); | ||
8 | + | ||
9 | +var _identity2 = _interopRequireDefault(_identity); | ||
10 | + | ||
11 | +var _createTester = require('./internal/createTester'); | ||
12 | + | ||
13 | +var _createTester2 = _interopRequireDefault(_createTester); | ||
14 | + | ||
15 | +var _doParallel = require('./internal/doParallel'); | ||
16 | + | ||
17 | +var _doParallel2 = _interopRequireDefault(_doParallel); | ||
18 | + | ||
19 | +var _findGetResult = require('./internal/findGetResult'); | ||
20 | + | ||
21 | +var _findGetResult2 = _interopRequireDefault(_findGetResult); | ||
22 | + | ||
23 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
24 | + | ||
25 | +/** | ||
26 | + * Returns the first value in `coll` that passes an async truth test. The | ||
27 | + * `iteratee` is applied in parallel, meaning the first iteratee to return | ||
28 | + * `true` will fire the detect `callback` with that result. That means the | ||
29 | + * result might not be the first item in the original `coll` (in terms of order) | ||
30 | + * that passes the test. | ||
31 | + | ||
32 | + * If order within the original `coll` is important, then look at | ||
33 | + * [`detectSeries`]{@link module:Collections.detectSeries}. | ||
34 | + * | ||
35 | + * @name detect | ||
36 | + * @static | ||
37 | + * @memberOf module:Collections | ||
38 | + * @method | ||
39 | + * @alias find | ||
40 | + * @category Collections | ||
41 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
42 | + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. | ||
43 | + * The iteratee must complete with a boolean value as its result. | ||
44 | + * Invoked with (item, callback). | ||
45 | + * @param {Function} [callback] - A callback which is called as soon as any | ||
46 | + * iteratee returns `true`, or after all the `iteratee` functions have finished. | ||
47 | + * Result will be the first item in the array that passes the truth test | ||
48 | + * (iteratee) or the value `undefined` if none passed. Invoked with | ||
49 | + * (err, result). | ||
50 | + * @example | ||
51 | + * | ||
52 | + * async.detect(['file1','file2','file3'], function(filePath, callback) { | ||
53 | + * fs.access(filePath, function(err) { | ||
54 | + * callback(null, !err) | ||
55 | + * }); | ||
56 | + * }, function(err, result) { | ||
57 | + * // result now equals the first file in the list that exists | ||
58 | + * }); | ||
59 | + */ | ||
60 | +exports.default = (0, _doParallel2.default)((0, _createTester2.default)(_identity2.default, _findGetResult2.default)); | ||
61 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/findLimit.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _identity = require('lodash/identity'); | ||
8 | + | ||
9 | +var _identity2 = _interopRequireDefault(_identity); | ||
10 | + | ||
11 | +var _createTester = require('./internal/createTester'); | ||
12 | + | ||
13 | +var _createTester2 = _interopRequireDefault(_createTester); | ||
14 | + | ||
15 | +var _doParallelLimit = require('./internal/doParallelLimit'); | ||
16 | + | ||
17 | +var _doParallelLimit2 = _interopRequireDefault(_doParallelLimit); | ||
18 | + | ||
19 | +var _findGetResult = require('./internal/findGetResult'); | ||
20 | + | ||
21 | +var _findGetResult2 = _interopRequireDefault(_findGetResult); | ||
22 | + | ||
23 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
24 | + | ||
25 | +/** | ||
26 | + * The same as [`detect`]{@link module:Collections.detect} but runs a maximum of `limit` async operations at a | ||
27 | + * time. | ||
28 | + * | ||
29 | + * @name detectLimit | ||
30 | + * @static | ||
31 | + * @memberOf module:Collections | ||
32 | + * @method | ||
33 | + * @see [async.detect]{@link module:Collections.detect} | ||
34 | + * @alias findLimit | ||
35 | + * @category Collections | ||
36 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
37 | + * @param {number} limit - The maximum number of async operations at a time. | ||
38 | + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. | ||
39 | + * The iteratee must complete with a boolean value as its result. | ||
40 | + * Invoked with (item, callback). | ||
41 | + * @param {Function} [callback] - A callback which is called as soon as any | ||
42 | + * iteratee returns `true`, or after all the `iteratee` functions have finished. | ||
43 | + * Result will be the first item in the array that passes the truth test | ||
44 | + * (iteratee) or the value `undefined` if none passed. Invoked with | ||
45 | + * (err, result). | ||
46 | + */ | ||
47 | +exports.default = (0, _doParallelLimit2.default)((0, _createTester2.default)(_identity2.default, _findGetResult2.default)); | ||
48 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/findSeries.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _detectLimit = require('./detectLimit'); | ||
8 | + | ||
9 | +var _detectLimit2 = _interopRequireDefault(_detectLimit); | ||
10 | + | ||
11 | +var _doLimit = require('./internal/doLimit'); | ||
12 | + | ||
13 | +var _doLimit2 = _interopRequireDefault(_doLimit); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * The same as [`detect`]{@link module:Collections.detect} but runs only a single async operation at a time. | ||
19 | + * | ||
20 | + * @name detectSeries | ||
21 | + * @static | ||
22 | + * @memberOf module:Collections | ||
23 | + * @method | ||
24 | + * @see [async.detect]{@link module:Collections.detect} | ||
25 | + * @alias findSeries | ||
26 | + * @category Collections | ||
27 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
28 | + * @param {AsyncFunction} iteratee - A truth test to apply to each item in `coll`. | ||
29 | + * The iteratee must complete with a boolean value as its result. | ||
30 | + * Invoked with (item, callback). | ||
31 | + * @param {Function} [callback] - A callback which is called as soon as any | ||
32 | + * iteratee returns `true`, or after all the `iteratee` functions have finished. | ||
33 | + * Result will be the first item in the array that passes the truth test | ||
34 | + * (iteratee) or the value `undefined` if none passed. Invoked with | ||
35 | + * (err, result). | ||
36 | + */ | ||
37 | +exports.default = (0, _doLimit2.default)(_detectLimit2.default, 1); | ||
38 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/foldl.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = reduce; | ||
7 | + | ||
8 | +var _eachOfSeries = require('./eachOfSeries'); | ||
9 | + | ||
10 | +var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); | ||
11 | + | ||
12 | +var _noop = require('lodash/noop'); | ||
13 | + | ||
14 | +var _noop2 = _interopRequireDefault(_noop); | ||
15 | + | ||
16 | +var _once = require('./internal/once'); | ||
17 | + | ||
18 | +var _once2 = _interopRequireDefault(_once); | ||
19 | + | ||
20 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
21 | + | ||
22 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
23 | + | ||
24 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
25 | + | ||
26 | +/** | ||
27 | + * Reduces `coll` into a single value using an async `iteratee` to return each | ||
28 | + * successive step. `memo` is the initial state of the reduction. This function | ||
29 | + * only operates in series. | ||
30 | + * | ||
31 | + * For performance reasons, it may make sense to split a call to this function | ||
32 | + * into a parallel map, and then use the normal `Array.prototype.reduce` on the | ||
33 | + * results. This function is for situations where each step in the reduction | ||
34 | + * needs to be async; if you can get the data before reducing it, then it's | ||
35 | + * probably a good idea to do so. | ||
36 | + * | ||
37 | + * @name reduce | ||
38 | + * @static | ||
39 | + * @memberOf module:Collections | ||
40 | + * @method | ||
41 | + * @alias inject | ||
42 | + * @alias foldl | ||
43 | + * @category Collection | ||
44 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
45 | + * @param {*} memo - The initial state of the reduction. | ||
46 | + * @param {AsyncFunction} iteratee - A function applied to each item in the | ||
47 | + * array to produce the next step in the reduction. | ||
48 | + * The `iteratee` should complete with the next state of the reduction. | ||
49 | + * If the iteratee complete with an error, the reduction is stopped and the | ||
50 | + * main `callback` is immediately called with the error. | ||
51 | + * Invoked with (memo, item, callback). | ||
52 | + * @param {Function} [callback] - A callback which is called after all the | ||
53 | + * `iteratee` functions have finished. Result is the reduced value. Invoked with | ||
54 | + * (err, result). | ||
55 | + * @example | ||
56 | + * | ||
57 | + * async.reduce([1,2,3], 0, function(memo, item, callback) { | ||
58 | + * // pointless async: | ||
59 | + * process.nextTick(function() { | ||
60 | + * callback(null, memo + item) | ||
61 | + * }); | ||
62 | + * }, function(err, result) { | ||
63 | + * // result is now equal to the last value of memo, which is 6 | ||
64 | + * }); | ||
65 | + */ | ||
66 | +function reduce(coll, memo, iteratee, callback) { | ||
67 | + callback = (0, _once2.default)(callback || _noop2.default); | ||
68 | + var _iteratee = (0, _wrapAsync2.default)(iteratee); | ||
69 | + (0, _eachOfSeries2.default)(coll, function (x, i, callback) { | ||
70 | + _iteratee(memo, x, function (err, v) { | ||
71 | + memo = v; | ||
72 | + callback(err); | ||
73 | + }); | ||
74 | + }, function (err) { | ||
75 | + callback(err, memo); | ||
76 | + }); | ||
77 | +} | ||
78 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/foldr.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = reduceRight; | ||
7 | + | ||
8 | +var _reduce = require('./reduce'); | ||
9 | + | ||
10 | +var _reduce2 = _interopRequireDefault(_reduce); | ||
11 | + | ||
12 | +var _slice = require('./internal/slice'); | ||
13 | + | ||
14 | +var _slice2 = _interopRequireDefault(_slice); | ||
15 | + | ||
16 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
17 | + | ||
18 | +/** | ||
19 | + * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order. | ||
20 | + * | ||
21 | + * @name reduceRight | ||
22 | + * @static | ||
23 | + * @memberOf module:Collections | ||
24 | + * @method | ||
25 | + * @see [async.reduce]{@link module:Collections.reduce} | ||
26 | + * @alias foldr | ||
27 | + * @category Collection | ||
28 | + * @param {Array} array - A collection to iterate over. | ||
29 | + * @param {*} memo - The initial state of the reduction. | ||
30 | + * @param {AsyncFunction} iteratee - A function applied to each item in the | ||
31 | + * array to produce the next step in the reduction. | ||
32 | + * The `iteratee` should complete with the next state of the reduction. | ||
33 | + * If the iteratee complete with an error, the reduction is stopped and the | ||
34 | + * main `callback` is immediately called with the error. | ||
35 | + * Invoked with (memo, item, callback). | ||
36 | + * @param {Function} [callback] - A callback which is called after all the | ||
37 | + * `iteratee` functions have finished. Result is the reduced value. Invoked with | ||
38 | + * (err, result). | ||
39 | + */ | ||
40 | +function reduceRight(array, memo, iteratee, callback) { | ||
41 | + var reversed = (0, _slice2.default)(array).reverse(); | ||
42 | + (0, _reduce2.default)(reversed, memo, iteratee, callback); | ||
43 | +} | ||
44 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/forEach.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = eachLimit; | ||
7 | + | ||
8 | +var _eachOf = require('./eachOf'); | ||
9 | + | ||
10 | +var _eachOf2 = _interopRequireDefault(_eachOf); | ||
11 | + | ||
12 | +var _withoutIndex = require('./internal/withoutIndex'); | ||
13 | + | ||
14 | +var _withoutIndex2 = _interopRequireDefault(_withoutIndex); | ||
15 | + | ||
16 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
17 | + | ||
18 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
19 | + | ||
20 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
21 | + | ||
22 | +/** | ||
23 | + * Applies the function `iteratee` to each item in `coll`, in parallel. | ||
24 | + * The `iteratee` is called with an item from the list, and a callback for when | ||
25 | + * it has finished. If the `iteratee` passes an error to its `callback`, the | ||
26 | + * main `callback` (for the `each` function) is immediately called with the | ||
27 | + * error. | ||
28 | + * | ||
29 | + * Note, that since this function applies `iteratee` to each item in parallel, | ||
30 | + * there is no guarantee that the iteratee functions will complete in order. | ||
31 | + * | ||
32 | + * @name each | ||
33 | + * @static | ||
34 | + * @memberOf module:Collections | ||
35 | + * @method | ||
36 | + * @alias forEach | ||
37 | + * @category Collection | ||
38 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
39 | + * @param {AsyncFunction} iteratee - An async function to apply to | ||
40 | + * each item in `coll`. Invoked with (item, callback). | ||
41 | + * The array index is not passed to the iteratee. | ||
42 | + * If you need the index, use `eachOf`. | ||
43 | + * @param {Function} [callback] - A callback which is called when all | ||
44 | + * `iteratee` functions have finished, or an error occurs. Invoked with (err). | ||
45 | + * @example | ||
46 | + * | ||
47 | + * // assuming openFiles is an array of file names and saveFile is a function | ||
48 | + * // to save the modified contents of that file: | ||
49 | + * | ||
50 | + * async.each(openFiles, saveFile, function(err){ | ||
51 | + * // if any of the saves produced an error, err would equal that error | ||
52 | + * }); | ||
53 | + * | ||
54 | + * // assuming openFiles is an array of file names | ||
55 | + * async.each(openFiles, function(file, callback) { | ||
56 | + * | ||
57 | + * // Perform operation on file here. | ||
58 | + * console.log('Processing file ' + file); | ||
59 | + * | ||
60 | + * if( file.length > 32 ) { | ||
61 | + * console.log('This file name is too long'); | ||
62 | + * callback('File name too long'); | ||
63 | + * } else { | ||
64 | + * // Do work to process file here | ||
65 | + * console.log('File processed'); | ||
66 | + * callback(); | ||
67 | + * } | ||
68 | + * }, function(err) { | ||
69 | + * // if any of the file processing produced an error, err would equal that error | ||
70 | + * if( err ) { | ||
71 | + * // One of the iterations produced an error. | ||
72 | + * // All processing will now stop. | ||
73 | + * console.log('A file failed to process'); | ||
74 | + * } else { | ||
75 | + * console.log('All files have been processed successfully'); | ||
76 | + * } | ||
77 | + * }); | ||
78 | + */ | ||
79 | +function eachLimit(coll, iteratee, callback) { | ||
80 | + (0, _eachOf2.default)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback); | ||
81 | +} | ||
82 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/forEachLimit.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = eachLimit; | ||
7 | + | ||
8 | +var _eachOfLimit = require('./internal/eachOfLimit'); | ||
9 | + | ||
10 | +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); | ||
11 | + | ||
12 | +var _withoutIndex = require('./internal/withoutIndex'); | ||
13 | + | ||
14 | +var _withoutIndex2 = _interopRequireDefault(_withoutIndex); | ||
15 | + | ||
16 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
17 | + | ||
18 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
19 | + | ||
20 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
21 | + | ||
22 | +/** | ||
23 | + * The same as [`each`]{@link module:Collections.each} but runs a maximum of `limit` async operations at a time. | ||
24 | + * | ||
25 | + * @name eachLimit | ||
26 | + * @static | ||
27 | + * @memberOf module:Collections | ||
28 | + * @method | ||
29 | + * @see [async.each]{@link module:Collections.each} | ||
30 | + * @alias forEachLimit | ||
31 | + * @category Collection | ||
32 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
33 | + * @param {number} limit - The maximum number of async operations at a time. | ||
34 | + * @param {AsyncFunction} iteratee - An async function to apply to each item in | ||
35 | + * `coll`. | ||
36 | + * The array index is not passed to the iteratee. | ||
37 | + * If you need the index, use `eachOfLimit`. | ||
38 | + * Invoked with (item, callback). | ||
39 | + * @param {Function} [callback] - A callback which is called when all | ||
40 | + * `iteratee` functions have finished, or an error occurs. Invoked with (err). | ||
41 | + */ | ||
42 | +function eachLimit(coll, limit, iteratee, callback) { | ||
43 | + (0, _eachOfLimit2.default)(limit)(coll, (0, _withoutIndex2.default)((0, _wrapAsync2.default)(iteratee)), callback); | ||
44 | +} | ||
45 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/forEachOf.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +exports.default = function (coll, iteratee, callback) { | ||
8 | + var eachOfImplementation = (0, _isArrayLike2.default)(coll) ? eachOfArrayLike : eachOfGeneric; | ||
9 | + eachOfImplementation(coll, (0, _wrapAsync2.default)(iteratee), callback); | ||
10 | +}; | ||
11 | + | ||
12 | +var _isArrayLike = require('lodash/isArrayLike'); | ||
13 | + | ||
14 | +var _isArrayLike2 = _interopRequireDefault(_isArrayLike); | ||
15 | + | ||
16 | +var _breakLoop = require('./internal/breakLoop'); | ||
17 | + | ||
18 | +var _breakLoop2 = _interopRequireDefault(_breakLoop); | ||
19 | + | ||
20 | +var _eachOfLimit = require('./eachOfLimit'); | ||
21 | + | ||
22 | +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); | ||
23 | + | ||
24 | +var _doLimit = require('./internal/doLimit'); | ||
25 | + | ||
26 | +var _doLimit2 = _interopRequireDefault(_doLimit); | ||
27 | + | ||
28 | +var _noop = require('lodash/noop'); | ||
29 | + | ||
30 | +var _noop2 = _interopRequireDefault(_noop); | ||
31 | + | ||
32 | +var _once = require('./internal/once'); | ||
33 | + | ||
34 | +var _once2 = _interopRequireDefault(_once); | ||
35 | + | ||
36 | +var _onlyOnce = require('./internal/onlyOnce'); | ||
37 | + | ||
38 | +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); | ||
39 | + | ||
40 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
41 | + | ||
42 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
43 | + | ||
44 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
45 | + | ||
46 | +// eachOf implementation optimized for array-likes | ||
47 | +function eachOfArrayLike(coll, iteratee, callback) { | ||
48 | + callback = (0, _once2.default)(callback || _noop2.default); | ||
49 | + var index = 0, | ||
50 | + completed = 0, | ||
51 | + length = coll.length; | ||
52 | + if (length === 0) { | ||
53 | + callback(null); | ||
54 | + } | ||
55 | + | ||
56 | + function iteratorCallback(err, value) { | ||
57 | + if (err) { | ||
58 | + callback(err); | ||
59 | + } else if (++completed === length || value === _breakLoop2.default) { | ||
60 | + callback(null); | ||
61 | + } | ||
62 | + } | ||
63 | + | ||
64 | + for (; index < length; index++) { | ||
65 | + iteratee(coll[index], index, (0, _onlyOnce2.default)(iteratorCallback)); | ||
66 | + } | ||
67 | +} | ||
68 | + | ||
69 | +// a generic version of eachOf which can handle array, object, and iterator cases. | ||
70 | +var eachOfGeneric = (0, _doLimit2.default)(_eachOfLimit2.default, Infinity); | ||
71 | + | ||
72 | +/** | ||
73 | + * Like [`each`]{@link module:Collections.each}, except that it passes the key (or index) as the second argument | ||
74 | + * to the iteratee. | ||
75 | + * | ||
76 | + * @name eachOf | ||
77 | + * @static | ||
78 | + * @memberOf module:Collections | ||
79 | + * @method | ||
80 | + * @alias forEachOf | ||
81 | + * @category Collection | ||
82 | + * @see [async.each]{@link module:Collections.each} | ||
83 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
84 | + * @param {AsyncFunction} iteratee - A function to apply to each | ||
85 | + * item in `coll`. | ||
86 | + * The `key` is the item's key, or index in the case of an array. | ||
87 | + * Invoked with (item, key, callback). | ||
88 | + * @param {Function} [callback] - A callback which is called when all | ||
89 | + * `iteratee` functions have finished, or an error occurs. Invoked with (err). | ||
90 | + * @example | ||
91 | + * | ||
92 | + * var obj = {dev: "/dev.json", test: "/test.json", prod: "/prod.json"}; | ||
93 | + * var configs = {}; | ||
94 | + * | ||
95 | + * async.forEachOf(obj, function (value, key, callback) { | ||
96 | + * fs.readFile(__dirname + value, "utf8", function (err, data) { | ||
97 | + * if (err) return callback(err); | ||
98 | + * try { | ||
99 | + * configs[key] = JSON.parse(data); | ||
100 | + * } catch (e) { | ||
101 | + * return callback(e); | ||
102 | + * } | ||
103 | + * callback(); | ||
104 | + * }); | ||
105 | + * }, function (err) { | ||
106 | + * if (err) console.error(err.message); | ||
107 | + * // configs is now a map of JSON data | ||
108 | + * doSomethingWith(configs); | ||
109 | + * }); | ||
110 | + */ | ||
111 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/forEachOfLimit.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = eachOfLimit; | ||
7 | + | ||
8 | +var _eachOfLimit2 = require('./internal/eachOfLimit'); | ||
9 | + | ||
10 | +var _eachOfLimit3 = _interopRequireDefault(_eachOfLimit2); | ||
11 | + | ||
12 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
13 | + | ||
14 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
15 | + | ||
16 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
17 | + | ||
18 | +/** | ||
19 | + * The same as [`eachOf`]{@link module:Collections.eachOf} but runs a maximum of `limit` async operations at a | ||
20 | + * time. | ||
21 | + * | ||
22 | + * @name eachOfLimit | ||
23 | + * @static | ||
24 | + * @memberOf module:Collections | ||
25 | + * @method | ||
26 | + * @see [async.eachOf]{@link module:Collections.eachOf} | ||
27 | + * @alias forEachOfLimit | ||
28 | + * @category Collection | ||
29 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
30 | + * @param {number} limit - The maximum number of async operations at a time. | ||
31 | + * @param {AsyncFunction} iteratee - An async function to apply to each | ||
32 | + * item in `coll`. The `key` is the item's key, or index in the case of an | ||
33 | + * array. | ||
34 | + * Invoked with (item, key, callback). | ||
35 | + * @param {Function} [callback] - A callback which is called when all | ||
36 | + * `iteratee` functions have finished, or an error occurs. Invoked with (err). | ||
37 | + */ | ||
38 | +function eachOfLimit(coll, limit, iteratee, callback) { | ||
39 | + (0, _eachOfLimit3.default)(limit)(coll, (0, _wrapAsync2.default)(iteratee), callback); | ||
40 | +} | ||
41 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/forEachOfSeries.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _eachOfLimit = require('./eachOfLimit'); | ||
8 | + | ||
9 | +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); | ||
10 | + | ||
11 | +var _doLimit = require('./internal/doLimit'); | ||
12 | + | ||
13 | +var _doLimit2 = _interopRequireDefault(_doLimit); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * The same as [`eachOf`]{@link module:Collections.eachOf} but runs only a single async operation at a time. | ||
19 | + * | ||
20 | + * @name eachOfSeries | ||
21 | + * @static | ||
22 | + * @memberOf module:Collections | ||
23 | + * @method | ||
24 | + * @see [async.eachOf]{@link module:Collections.eachOf} | ||
25 | + * @alias forEachOfSeries | ||
26 | + * @category Collection | ||
27 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
28 | + * @param {AsyncFunction} iteratee - An async function to apply to each item in | ||
29 | + * `coll`. | ||
30 | + * Invoked with (item, key, callback). | ||
31 | + * @param {Function} [callback] - A callback which is called when all `iteratee` | ||
32 | + * functions have finished, or an error occurs. Invoked with (err). | ||
33 | + */ | ||
34 | +exports.default = (0, _doLimit2.default)(_eachOfLimit2.default, 1); | ||
35 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/forEachSeries.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _eachLimit = require('./eachLimit'); | ||
8 | + | ||
9 | +var _eachLimit2 = _interopRequireDefault(_eachLimit); | ||
10 | + | ||
11 | +var _doLimit = require('./internal/doLimit'); | ||
12 | + | ||
13 | +var _doLimit2 = _interopRequireDefault(_doLimit); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * The same as [`each`]{@link module:Collections.each} but runs only a single async operation at a time. | ||
19 | + * | ||
20 | + * @name eachSeries | ||
21 | + * @static | ||
22 | + * @memberOf module:Collections | ||
23 | + * @method | ||
24 | + * @see [async.each]{@link module:Collections.each} | ||
25 | + * @alias forEachSeries | ||
26 | + * @category Collection | ||
27 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
28 | + * @param {AsyncFunction} iteratee - An async function to apply to each | ||
29 | + * item in `coll`. | ||
30 | + * The array index is not passed to the iteratee. | ||
31 | + * If you need the index, use `eachOfSeries`. | ||
32 | + * Invoked with (item, callback). | ||
33 | + * @param {Function} [callback] - A callback which is called when all | ||
34 | + * `iteratee` functions have finished, or an error occurs. Invoked with (err). | ||
35 | + */ | ||
36 | +exports.default = (0, _doLimit2.default)(_eachLimit2.default, 1); | ||
37 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/forever.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = forever; | ||
7 | + | ||
8 | +var _noop = require('lodash/noop'); | ||
9 | + | ||
10 | +var _noop2 = _interopRequireDefault(_noop); | ||
11 | + | ||
12 | +var _onlyOnce = require('./internal/onlyOnce'); | ||
13 | + | ||
14 | +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); | ||
15 | + | ||
16 | +var _ensureAsync = require('./ensureAsync'); | ||
17 | + | ||
18 | +var _ensureAsync2 = _interopRequireDefault(_ensureAsync); | ||
19 | + | ||
20 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
21 | + | ||
22 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
23 | + | ||
24 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
25 | + | ||
26 | +/** | ||
27 | + * Calls the asynchronous function `fn` with a callback parameter that allows it | ||
28 | + * to call itself again, in series, indefinitely. | ||
29 | + | ||
30 | + * If an error is passed to the callback then `errback` is called with the | ||
31 | + * error, and execution stops, otherwise it will never be called. | ||
32 | + * | ||
33 | + * @name forever | ||
34 | + * @static | ||
35 | + * @memberOf module:ControlFlow | ||
36 | + * @method | ||
37 | + * @category Control Flow | ||
38 | + * @param {AsyncFunction} fn - an async function to call repeatedly. | ||
39 | + * Invoked with (next). | ||
40 | + * @param {Function} [errback] - when `fn` passes an error to it's callback, | ||
41 | + * this function will be called, and execution stops. Invoked with (err). | ||
42 | + * @example | ||
43 | + * | ||
44 | + * async.forever( | ||
45 | + * function(next) { | ||
46 | + * // next is suitable for passing to things that need a callback(err [, whatever]); | ||
47 | + * // it will result in this function being called again. | ||
48 | + * }, | ||
49 | + * function(err) { | ||
50 | + * // if next is called with a value in its first parameter, it will appear | ||
51 | + * // in here as 'err', and execution will stop. | ||
52 | + * } | ||
53 | + * ); | ||
54 | + */ | ||
55 | +function forever(fn, errback) { | ||
56 | + var done = (0, _onlyOnce2.default)(errback || _noop2.default); | ||
57 | + var task = (0, _wrapAsync2.default)((0, _ensureAsync2.default)(fn)); | ||
58 | + | ||
59 | + function next(err) { | ||
60 | + if (err) return done(err); | ||
61 | + task(next); | ||
62 | + } | ||
63 | + next(); | ||
64 | +} | ||
65 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/groupBy.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _doLimit = require('./internal/doLimit'); | ||
8 | + | ||
9 | +var _doLimit2 = _interopRequireDefault(_doLimit); | ||
10 | + | ||
11 | +var _groupByLimit = require('./groupByLimit'); | ||
12 | + | ||
13 | +var _groupByLimit2 = _interopRequireDefault(_groupByLimit); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * Returns a new object, where each value corresponds to an array of items, from | ||
19 | + * `coll`, that returned the corresponding key. That is, the keys of the object | ||
20 | + * correspond to the values passed to the `iteratee` callback. | ||
21 | + * | ||
22 | + * Note: Since this function applies the `iteratee` to each item in parallel, | ||
23 | + * there is no guarantee that the `iteratee` functions will complete in order. | ||
24 | + * However, the values for each key in the `result` will be in the same order as | ||
25 | + * the original `coll`. For Objects, the values will roughly be in the order of | ||
26 | + * the original Objects' keys (but this can vary across JavaScript engines). | ||
27 | + * | ||
28 | + * @name groupBy | ||
29 | + * @static | ||
30 | + * @memberOf module:Collections | ||
31 | + * @method | ||
32 | + * @category Collection | ||
33 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
34 | + * @param {AsyncFunction} iteratee - An async function to apply to each item in | ||
35 | + * `coll`. | ||
36 | + * The iteratee should complete with a `key` to group the value under. | ||
37 | + * Invoked with (value, callback). | ||
38 | + * @param {Function} [callback] - A callback which is called when all `iteratee` | ||
39 | + * functions have finished, or an error occurs. Result is an `Object` whoses | ||
40 | + * properties are arrays of values which returned the corresponding key. | ||
41 | + * @example | ||
42 | + * | ||
43 | + * async.groupBy(['userId1', 'userId2', 'userId3'], function(userId, callback) { | ||
44 | + * db.findById(userId, function(err, user) { | ||
45 | + * if (err) return callback(err); | ||
46 | + * return callback(null, user.age); | ||
47 | + * }); | ||
48 | + * }, function(err, result) { | ||
49 | + * // result is object containing the userIds grouped by age | ||
50 | + * // e.g. { 30: ['userId1', 'userId3'], 42: ['userId2']}; | ||
51 | + * }); | ||
52 | + */ | ||
53 | +exports.default = (0, _doLimit2.default)(_groupByLimit2.default, Infinity); | ||
54 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/groupByLimit.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +exports.default = function (coll, limit, iteratee, callback) { | ||
8 | + callback = callback || _noop2.default; | ||
9 | + var _iteratee = (0, _wrapAsync2.default)(iteratee); | ||
10 | + (0, _mapLimit2.default)(coll, limit, function (val, callback) { | ||
11 | + _iteratee(val, function (err, key) { | ||
12 | + if (err) return callback(err); | ||
13 | + return callback(null, { key: key, val: val }); | ||
14 | + }); | ||
15 | + }, function (err, mapResults) { | ||
16 | + var result = {}; | ||
17 | + // from MDN, handle object having an `hasOwnProperty` prop | ||
18 | + var hasOwnProperty = Object.prototype.hasOwnProperty; | ||
19 | + | ||
20 | + for (var i = 0; i < mapResults.length; i++) { | ||
21 | + if (mapResults[i]) { | ||
22 | + var key = mapResults[i].key; | ||
23 | + var val = mapResults[i].val; | ||
24 | + | ||
25 | + if (hasOwnProperty.call(result, key)) { | ||
26 | + result[key].push(val); | ||
27 | + } else { | ||
28 | + result[key] = [val]; | ||
29 | + } | ||
30 | + } | ||
31 | + } | ||
32 | + | ||
33 | + return callback(err, result); | ||
34 | + }); | ||
35 | +}; | ||
36 | + | ||
37 | +var _noop = require('lodash/noop'); | ||
38 | + | ||
39 | +var _noop2 = _interopRequireDefault(_noop); | ||
40 | + | ||
41 | +var _mapLimit = require('./mapLimit'); | ||
42 | + | ||
43 | +var _mapLimit2 = _interopRequireDefault(_mapLimit); | ||
44 | + | ||
45 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
46 | + | ||
47 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
48 | + | ||
49 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
50 | + | ||
51 | +; | ||
52 | +/** | ||
53 | + * The same as [`groupBy`]{@link module:Collections.groupBy} but runs a maximum of `limit` async operations at a time. | ||
54 | + * | ||
55 | + * @name groupByLimit | ||
56 | + * @static | ||
57 | + * @memberOf module:Collections | ||
58 | + * @method | ||
59 | + * @see [async.groupBy]{@link module:Collections.groupBy} | ||
60 | + * @category Collection | ||
61 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
62 | + * @param {number} limit - The maximum number of async operations at a time. | ||
63 | + * @param {AsyncFunction} iteratee - An async function to apply to each item in | ||
64 | + * `coll`. | ||
65 | + * The iteratee should complete with a `key` to group the value under. | ||
66 | + * Invoked with (value, callback). | ||
67 | + * @param {Function} [callback] - A callback which is called when all `iteratee` | ||
68 | + * functions have finished, or an error occurs. Result is an `Object` whoses | ||
69 | + * properties are arrays of values which returned the corresponding key. | ||
70 | + */ | ||
71 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/groupBySeries.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +var _doLimit = require('./internal/doLimit'); | ||
8 | + | ||
9 | +var _doLimit2 = _interopRequireDefault(_doLimit); | ||
10 | + | ||
11 | +var _groupByLimit = require('./groupByLimit'); | ||
12 | + | ||
13 | +var _groupByLimit2 = _interopRequireDefault(_groupByLimit); | ||
14 | + | ||
15 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
16 | + | ||
17 | +/** | ||
18 | + * The same as [`groupBy`]{@link module:Collections.groupBy} but runs only a single async operation at a time. | ||
19 | + * | ||
20 | + * @name groupBySeries | ||
21 | + * @static | ||
22 | + * @memberOf module:Collections | ||
23 | + * @method | ||
24 | + * @see [async.groupBy]{@link module:Collections.groupBy} | ||
25 | + * @category Collection | ||
26 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
27 | + * @param {number} limit - The maximum number of async operations at a time. | ||
28 | + * @param {AsyncFunction} iteratee - An async function to apply to each item in | ||
29 | + * `coll`. | ||
30 | + * The iteratee should complete with a `key` to group the value under. | ||
31 | + * Invoked with (value, callback). | ||
32 | + * @param {Function} [callback] - A callback which is called when all `iteratee` | ||
33 | + * functions have finished, or an error occurs. Result is an `Object` whoses | ||
34 | + * properties are arrays of values which returned the corresponding key. | ||
35 | + */ | ||
36 | +exports.default = (0, _doLimit2.default)(_groupByLimit2.default, 1); | ||
37 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/index.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/inject.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = reduce; | ||
7 | + | ||
8 | +var _eachOfSeries = require('./eachOfSeries'); | ||
9 | + | ||
10 | +var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries); | ||
11 | + | ||
12 | +var _noop = require('lodash/noop'); | ||
13 | + | ||
14 | +var _noop2 = _interopRequireDefault(_noop); | ||
15 | + | ||
16 | +var _once = require('./internal/once'); | ||
17 | + | ||
18 | +var _once2 = _interopRequireDefault(_once); | ||
19 | + | ||
20 | +var _wrapAsync = require('./internal/wrapAsync'); | ||
21 | + | ||
22 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
23 | + | ||
24 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
25 | + | ||
26 | +/** | ||
27 | + * Reduces `coll` into a single value using an async `iteratee` to return each | ||
28 | + * successive step. `memo` is the initial state of the reduction. This function | ||
29 | + * only operates in series. | ||
30 | + * | ||
31 | + * For performance reasons, it may make sense to split a call to this function | ||
32 | + * into a parallel map, and then use the normal `Array.prototype.reduce` on the | ||
33 | + * results. This function is for situations where each step in the reduction | ||
34 | + * needs to be async; if you can get the data before reducing it, then it's | ||
35 | + * probably a good idea to do so. | ||
36 | + * | ||
37 | + * @name reduce | ||
38 | + * @static | ||
39 | + * @memberOf module:Collections | ||
40 | + * @method | ||
41 | + * @alias inject | ||
42 | + * @alias foldl | ||
43 | + * @category Collection | ||
44 | + * @param {Array|Iterable|Object} coll - A collection to iterate over. | ||
45 | + * @param {*} memo - The initial state of the reduction. | ||
46 | + * @param {AsyncFunction} iteratee - A function applied to each item in the | ||
47 | + * array to produce the next step in the reduction. | ||
48 | + * The `iteratee` should complete with the next state of the reduction. | ||
49 | + * If the iteratee complete with an error, the reduction is stopped and the | ||
50 | + * main `callback` is immediately called with the error. | ||
51 | + * Invoked with (memo, item, callback). | ||
52 | + * @param {Function} [callback] - A callback which is called after all the | ||
53 | + * `iteratee` functions have finished. Result is the reduced value. Invoked with | ||
54 | + * (err, result). | ||
55 | + * @example | ||
56 | + * | ||
57 | + * async.reduce([1,2,3], 0, function(memo, item, callback) { | ||
58 | + * // pointless async: | ||
59 | + * process.nextTick(function() { | ||
60 | + * callback(null, memo + item) | ||
61 | + * }); | ||
62 | + * }, function(err, result) { | ||
63 | + * // result is now equal to the last value of memo, which is 6 | ||
64 | + * }); | ||
65 | + */ | ||
66 | +function reduce(coll, memo, iteratee, callback) { | ||
67 | + callback = (0, _once2.default)(callback || _noop2.default); | ||
68 | + var _iteratee = (0, _wrapAsync2.default)(iteratee); | ||
69 | + (0, _eachOfSeries2.default)(coll, function (x, i, callback) { | ||
70 | + _iteratee(memo, x, function (err, v) { | ||
71 | + memo = v; | ||
72 | + callback(err); | ||
73 | + }); | ||
74 | + }, function (err) { | ||
75 | + callback(err, memo); | ||
76 | + }); | ||
77 | +} | ||
78 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +"use strict"; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = DLL; | ||
7 | +// Simple doubly linked list (https://en.wikipedia.org/wiki/Doubly_linked_list) implementation | ||
8 | +// used for queues. This implementation assumes that the node provided by the user can be modified | ||
9 | +// to adjust the next and last properties. We implement only the minimal functionality | ||
10 | +// for queue support. | ||
11 | +function DLL() { | ||
12 | + this.head = this.tail = null; | ||
13 | + this.length = 0; | ||
14 | +} | ||
15 | + | ||
16 | +function setInitial(dll, node) { | ||
17 | + dll.length = 1; | ||
18 | + dll.head = dll.tail = node; | ||
19 | +} | ||
20 | + | ||
21 | +DLL.prototype.removeLink = function (node) { | ||
22 | + if (node.prev) node.prev.next = node.next;else this.head = node.next; | ||
23 | + if (node.next) node.next.prev = node.prev;else this.tail = node.prev; | ||
24 | + | ||
25 | + node.prev = node.next = null; | ||
26 | + this.length -= 1; | ||
27 | + return node; | ||
28 | +}; | ||
29 | + | ||
30 | +DLL.prototype.empty = function () { | ||
31 | + while (this.head) this.shift(); | ||
32 | + return this; | ||
33 | +}; | ||
34 | + | ||
35 | +DLL.prototype.insertAfter = function (node, newNode) { | ||
36 | + newNode.prev = node; | ||
37 | + newNode.next = node.next; | ||
38 | + if (node.next) node.next.prev = newNode;else this.tail = newNode; | ||
39 | + node.next = newNode; | ||
40 | + this.length += 1; | ||
41 | +}; | ||
42 | + | ||
43 | +DLL.prototype.insertBefore = function (node, newNode) { | ||
44 | + newNode.prev = node.prev; | ||
45 | + newNode.next = node; | ||
46 | + if (node.prev) node.prev.next = newNode;else this.head = newNode; | ||
47 | + node.prev = newNode; | ||
48 | + this.length += 1; | ||
49 | +}; | ||
50 | + | ||
51 | +DLL.prototype.unshift = function (node) { | ||
52 | + if (this.head) this.insertBefore(this.head, node);else setInitial(this, node); | ||
53 | +}; | ||
54 | + | ||
55 | +DLL.prototype.push = function (node) { | ||
56 | + if (this.tail) this.insertAfter(this.tail, node);else setInitial(this, node); | ||
57 | +}; | ||
58 | + | ||
59 | +DLL.prototype.shift = function () { | ||
60 | + return this.head && this.removeLink(this.head); | ||
61 | +}; | ||
62 | + | ||
63 | +DLL.prototype.pop = function () { | ||
64 | + return this.tail && this.removeLink(this.tail); | ||
65 | +}; | ||
66 | + | ||
67 | +DLL.prototype.toArray = function () { | ||
68 | + var arr = Array(this.length); | ||
69 | + var curr = this.head; | ||
70 | + for (var idx = 0; idx < this.length; idx++) { | ||
71 | + arr[idx] = curr.data; | ||
72 | + curr = curr.next; | ||
73 | + } | ||
74 | + return arr; | ||
75 | +}; | ||
76 | + | ||
77 | +DLL.prototype.remove = function (testFn) { | ||
78 | + var curr = this.head; | ||
79 | + while (!!curr) { | ||
80 | + var next = curr.next; | ||
81 | + if (testFn(curr)) { | ||
82 | + this.removeLink(curr); | ||
83 | + } | ||
84 | + curr = next; | ||
85 | + } | ||
86 | + return this; | ||
87 | +}; | ||
88 | +module.exports = exports["default"]; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/applyEach.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = applyEach; | ||
7 | + | ||
8 | +var _slice = require('./slice'); | ||
9 | + | ||
10 | +var _slice2 = _interopRequireDefault(_slice); | ||
11 | + | ||
12 | +var _initialParams = require('./initialParams'); | ||
13 | + | ||
14 | +var _initialParams2 = _interopRequireDefault(_initialParams); | ||
15 | + | ||
16 | +var _wrapAsync = require('./wrapAsync'); | ||
17 | + | ||
18 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
19 | + | ||
20 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
21 | + | ||
22 | +function applyEach(eachfn) { | ||
23 | + return function (fns /*, ...args*/) { | ||
24 | + var args = (0, _slice2.default)(arguments, 1); | ||
25 | + var go = (0, _initialParams2.default)(function (args, callback) { | ||
26 | + var that = this; | ||
27 | + return eachfn(fns, function (fn, cb) { | ||
28 | + (0, _wrapAsync2.default)(fn).apply(that, args.concat(cb)); | ||
29 | + }, callback); | ||
30 | + }); | ||
31 | + if (args.length) { | ||
32 | + return go.apply(this, args); | ||
33 | + } else { | ||
34 | + return go; | ||
35 | + } | ||
36 | + }; | ||
37 | +} | ||
38 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/breakLoop.js
0 → 100644
1 | +"use strict"; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +// A temporary value used to identify if the loop should be broken. | ||
7 | +// See #1064, #1293 | ||
8 | +exports.default = {}; | ||
9 | +module.exports = exports["default"]; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/consoleFunc.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = consoleFunc; | ||
7 | + | ||
8 | +var _arrayEach = require('lodash/_arrayEach'); | ||
9 | + | ||
10 | +var _arrayEach2 = _interopRequireDefault(_arrayEach); | ||
11 | + | ||
12 | +var _slice = require('./slice'); | ||
13 | + | ||
14 | +var _slice2 = _interopRequireDefault(_slice); | ||
15 | + | ||
16 | +var _wrapAsync = require('./wrapAsync'); | ||
17 | + | ||
18 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
19 | + | ||
20 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
21 | + | ||
22 | +function consoleFunc(name) { | ||
23 | + return function (fn /*, ...args*/) { | ||
24 | + var args = (0, _slice2.default)(arguments, 1); | ||
25 | + args.push(function (err /*, ...args*/) { | ||
26 | + var args = (0, _slice2.default)(arguments, 1); | ||
27 | + if (typeof console === 'object') { | ||
28 | + if (err) { | ||
29 | + if (console.error) { | ||
30 | + console.error(err); | ||
31 | + } | ||
32 | + } else if (console[name]) { | ||
33 | + (0, _arrayEach2.default)(args, function (x) { | ||
34 | + console[name](x); | ||
35 | + }); | ||
36 | + } | ||
37 | + } | ||
38 | + }); | ||
39 | + (0, _wrapAsync2.default)(fn).apply(null, args); | ||
40 | + }; | ||
41 | +} | ||
42 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/createTester.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = _createTester; | ||
7 | + | ||
8 | +var _noop = require('lodash/noop'); | ||
9 | + | ||
10 | +var _noop2 = _interopRequireDefault(_noop); | ||
11 | + | ||
12 | +var _breakLoop = require('./breakLoop'); | ||
13 | + | ||
14 | +var _breakLoop2 = _interopRequireDefault(_breakLoop); | ||
15 | + | ||
16 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
17 | + | ||
18 | +function _createTester(check, getResult) { | ||
19 | + return function (eachfn, arr, iteratee, cb) { | ||
20 | + cb = cb || _noop2.default; | ||
21 | + var testPassed = false; | ||
22 | + var testResult; | ||
23 | + eachfn(arr, function (value, _, callback) { | ||
24 | + iteratee(value, function (err, result) { | ||
25 | + if (err) { | ||
26 | + callback(err); | ||
27 | + } else if (check(result) && !testResult) { | ||
28 | + testPassed = true; | ||
29 | + testResult = getResult(true, value); | ||
30 | + callback(null, _breakLoop2.default); | ||
31 | + } else { | ||
32 | + callback(); | ||
33 | + } | ||
34 | + }); | ||
35 | + }, function (err) { | ||
36 | + if (err) { | ||
37 | + cb(err); | ||
38 | + } else { | ||
39 | + cb(null, testPassed ? testResult : getResult(false)); | ||
40 | + } | ||
41 | + }); | ||
42 | + }; | ||
43 | +} | ||
44 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/doLimit.js
0 → 100644
1 | +"use strict"; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = doLimit; | ||
7 | +function doLimit(fn, limit) { | ||
8 | + return function (iterable, iteratee, callback) { | ||
9 | + return fn(iterable, limit, iteratee, callback); | ||
10 | + }; | ||
11 | +} | ||
12 | +module.exports = exports["default"]; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/doParallel.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = doParallel; | ||
7 | + | ||
8 | +var _eachOf = require('../eachOf'); | ||
9 | + | ||
10 | +var _eachOf2 = _interopRequireDefault(_eachOf); | ||
11 | + | ||
12 | +var _wrapAsync = require('./wrapAsync'); | ||
13 | + | ||
14 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
15 | + | ||
16 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
17 | + | ||
18 | +function doParallel(fn) { | ||
19 | + return function (obj, iteratee, callback) { | ||
20 | + return fn(_eachOf2.default, obj, (0, _wrapAsync2.default)(iteratee), callback); | ||
21 | + }; | ||
22 | +} | ||
23 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = doParallelLimit; | ||
7 | + | ||
8 | +var _eachOfLimit = require('./eachOfLimit'); | ||
9 | + | ||
10 | +var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit); | ||
11 | + | ||
12 | +var _wrapAsync = require('./wrapAsync'); | ||
13 | + | ||
14 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
15 | + | ||
16 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
17 | + | ||
18 | +function doParallelLimit(fn) { | ||
19 | + return function (obj, limit, iteratee, callback) { | ||
20 | + return fn((0, _eachOfLimit2.default)(limit), obj, (0, _wrapAsync2.default)(iteratee), callback); | ||
21 | + }; | ||
22 | +} | ||
23 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/eachOfLimit.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = _eachOfLimit; | ||
7 | + | ||
8 | +var _noop = require('lodash/noop'); | ||
9 | + | ||
10 | +var _noop2 = _interopRequireDefault(_noop); | ||
11 | + | ||
12 | +var _once = require('./once'); | ||
13 | + | ||
14 | +var _once2 = _interopRequireDefault(_once); | ||
15 | + | ||
16 | +var _iterator = require('./iterator'); | ||
17 | + | ||
18 | +var _iterator2 = _interopRequireDefault(_iterator); | ||
19 | + | ||
20 | +var _onlyOnce = require('./onlyOnce'); | ||
21 | + | ||
22 | +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); | ||
23 | + | ||
24 | +var _breakLoop = require('./breakLoop'); | ||
25 | + | ||
26 | +var _breakLoop2 = _interopRequireDefault(_breakLoop); | ||
27 | + | ||
28 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
29 | + | ||
30 | +function _eachOfLimit(limit) { | ||
31 | + return function (obj, iteratee, callback) { | ||
32 | + callback = (0, _once2.default)(callback || _noop2.default); | ||
33 | + if (limit <= 0 || !obj) { | ||
34 | + return callback(null); | ||
35 | + } | ||
36 | + var nextElem = (0, _iterator2.default)(obj); | ||
37 | + var done = false; | ||
38 | + var running = 0; | ||
39 | + var looping = false; | ||
40 | + | ||
41 | + function iterateeCallback(err, value) { | ||
42 | + running -= 1; | ||
43 | + if (err) { | ||
44 | + done = true; | ||
45 | + callback(err); | ||
46 | + } else if (value === _breakLoop2.default || done && running <= 0) { | ||
47 | + done = true; | ||
48 | + return callback(null); | ||
49 | + } else if (!looping) { | ||
50 | + replenish(); | ||
51 | + } | ||
52 | + } | ||
53 | + | ||
54 | + function replenish() { | ||
55 | + looping = true; | ||
56 | + while (running < limit && !done) { | ||
57 | + var elem = nextElem(); | ||
58 | + if (elem === null) { | ||
59 | + done = true; | ||
60 | + if (running <= 0) { | ||
61 | + callback(null); | ||
62 | + } | ||
63 | + return; | ||
64 | + } | ||
65 | + running += 1; | ||
66 | + iteratee(elem.value, elem.key, (0, _onlyOnce2.default)(iterateeCallback)); | ||
67 | + } | ||
68 | + looping = false; | ||
69 | + } | ||
70 | + | ||
71 | + replenish(); | ||
72 | + }; | ||
73 | +} | ||
74 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/filter.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = _filter; | ||
7 | + | ||
8 | +var _arrayMap = require('lodash/_arrayMap'); | ||
9 | + | ||
10 | +var _arrayMap2 = _interopRequireDefault(_arrayMap); | ||
11 | + | ||
12 | +var _isArrayLike = require('lodash/isArrayLike'); | ||
13 | + | ||
14 | +var _isArrayLike2 = _interopRequireDefault(_isArrayLike); | ||
15 | + | ||
16 | +var _baseProperty = require('lodash/_baseProperty'); | ||
17 | + | ||
18 | +var _baseProperty2 = _interopRequireDefault(_baseProperty); | ||
19 | + | ||
20 | +var _noop = require('lodash/noop'); | ||
21 | + | ||
22 | +var _noop2 = _interopRequireDefault(_noop); | ||
23 | + | ||
24 | +var _wrapAsync = require('./wrapAsync'); | ||
25 | + | ||
26 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
27 | + | ||
28 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
29 | + | ||
30 | +function filterArray(eachfn, arr, iteratee, callback) { | ||
31 | + var truthValues = new Array(arr.length); | ||
32 | + eachfn(arr, function (x, index, callback) { | ||
33 | + iteratee(x, function (err, v) { | ||
34 | + truthValues[index] = !!v; | ||
35 | + callback(err); | ||
36 | + }); | ||
37 | + }, function (err) { | ||
38 | + if (err) return callback(err); | ||
39 | + var results = []; | ||
40 | + for (var i = 0; i < arr.length; i++) { | ||
41 | + if (truthValues[i]) results.push(arr[i]); | ||
42 | + } | ||
43 | + callback(null, results); | ||
44 | + }); | ||
45 | +} | ||
46 | + | ||
47 | +function filterGeneric(eachfn, coll, iteratee, callback) { | ||
48 | + var results = []; | ||
49 | + eachfn(coll, function (x, index, callback) { | ||
50 | + iteratee(x, function (err, v) { | ||
51 | + if (err) { | ||
52 | + callback(err); | ||
53 | + } else { | ||
54 | + if (v) { | ||
55 | + results.push({ index: index, value: x }); | ||
56 | + } | ||
57 | + callback(); | ||
58 | + } | ||
59 | + }); | ||
60 | + }, function (err) { | ||
61 | + if (err) { | ||
62 | + callback(err); | ||
63 | + } else { | ||
64 | + callback(null, (0, _arrayMap2.default)(results.sort(function (a, b) { | ||
65 | + return a.index - b.index; | ||
66 | + }), (0, _baseProperty2.default)('value'))); | ||
67 | + } | ||
68 | + }); | ||
69 | +} | ||
70 | + | ||
71 | +function _filter(eachfn, coll, iteratee, callback) { | ||
72 | + var filter = (0, _isArrayLike2.default)(coll) ? filterArray : filterGeneric; | ||
73 | + filter(eachfn, coll, (0, _wrapAsync2.default)(iteratee), callback || _noop2.default); | ||
74 | +} | ||
75 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/findGetResult.js
0 → 100644
node_modules/async/internal/getIterator.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +exports.default = function (coll) { | ||
8 | + return iteratorSymbol && coll[iteratorSymbol] && coll[iteratorSymbol](); | ||
9 | +}; | ||
10 | + | ||
11 | +var iteratorSymbol = typeof Symbol === 'function' && Symbol.iterator; | ||
12 | + | ||
13 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/initialParams.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | + | ||
7 | +exports.default = function (fn) { | ||
8 | + return function () /*...args, callback*/{ | ||
9 | + var args = (0, _slice2.default)(arguments); | ||
10 | + var callback = args.pop(); | ||
11 | + fn.call(this, args, callback); | ||
12 | + }; | ||
13 | +}; | ||
14 | + | ||
15 | +var _slice = require('./slice'); | ||
16 | + | ||
17 | +var _slice2 = _interopRequireDefault(_slice); | ||
18 | + | ||
19 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
20 | + | ||
21 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/iterator.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = iterator; | ||
7 | + | ||
8 | +var _isArrayLike = require('lodash/isArrayLike'); | ||
9 | + | ||
10 | +var _isArrayLike2 = _interopRequireDefault(_isArrayLike); | ||
11 | + | ||
12 | +var _getIterator = require('./getIterator'); | ||
13 | + | ||
14 | +var _getIterator2 = _interopRequireDefault(_getIterator); | ||
15 | + | ||
16 | +var _keys = require('lodash/keys'); | ||
17 | + | ||
18 | +var _keys2 = _interopRequireDefault(_keys); | ||
19 | + | ||
20 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
21 | + | ||
22 | +function createArrayIterator(coll) { | ||
23 | + var i = -1; | ||
24 | + var len = coll.length; | ||
25 | + return function next() { | ||
26 | + return ++i < len ? { value: coll[i], key: i } : null; | ||
27 | + }; | ||
28 | +} | ||
29 | + | ||
30 | +function createES2015Iterator(iterator) { | ||
31 | + var i = -1; | ||
32 | + return function next() { | ||
33 | + var item = iterator.next(); | ||
34 | + if (item.done) return null; | ||
35 | + i++; | ||
36 | + return { value: item.value, key: i }; | ||
37 | + }; | ||
38 | +} | ||
39 | + | ||
40 | +function createObjectIterator(obj) { | ||
41 | + var okeys = (0, _keys2.default)(obj); | ||
42 | + var i = -1; | ||
43 | + var len = okeys.length; | ||
44 | + return function next() { | ||
45 | + var key = okeys[++i]; | ||
46 | + return i < len ? { value: obj[key], key: key } : null; | ||
47 | + }; | ||
48 | +} | ||
49 | + | ||
50 | +function iterator(coll) { | ||
51 | + if ((0, _isArrayLike2.default)(coll)) { | ||
52 | + return createArrayIterator(coll); | ||
53 | + } | ||
54 | + | ||
55 | + var iterator = (0, _getIterator2.default)(coll); | ||
56 | + return iterator ? createES2015Iterator(iterator) : createObjectIterator(coll); | ||
57 | +} | ||
58 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/map.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = _asyncMap; | ||
7 | + | ||
8 | +var _noop = require('lodash/noop'); | ||
9 | + | ||
10 | +var _noop2 = _interopRequireDefault(_noop); | ||
11 | + | ||
12 | +var _wrapAsync = require('./wrapAsync'); | ||
13 | + | ||
14 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
15 | + | ||
16 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
17 | + | ||
18 | +function _asyncMap(eachfn, arr, iteratee, callback) { | ||
19 | + callback = callback || _noop2.default; | ||
20 | + arr = arr || []; | ||
21 | + var results = []; | ||
22 | + var counter = 0; | ||
23 | + var _iteratee = (0, _wrapAsync2.default)(iteratee); | ||
24 | + | ||
25 | + eachfn(arr, function (value, _, callback) { | ||
26 | + var index = counter++; | ||
27 | + _iteratee(value, function (err, v) { | ||
28 | + results[index] = v; | ||
29 | + callback(err); | ||
30 | + }); | ||
31 | + }, function (err) { | ||
32 | + callback(err, results); | ||
33 | + }); | ||
34 | +} | ||
35 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/notId.js
0 → 100644
node_modules/async/internal/once.js
0 → 100644
1 | +"use strict"; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = once; | ||
7 | +function once(fn) { | ||
8 | + return function () { | ||
9 | + if (fn === null) return; | ||
10 | + var callFn = fn; | ||
11 | + fn = null; | ||
12 | + callFn.apply(this, arguments); | ||
13 | + }; | ||
14 | +} | ||
15 | +module.exports = exports["default"]; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/onlyOnce.js
0 → 100644
1 | +"use strict"; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = onlyOnce; | ||
7 | +function onlyOnce(fn) { | ||
8 | + return function () { | ||
9 | + if (fn === null) throw new Error("Callback was already called."); | ||
10 | + var callFn = fn; | ||
11 | + fn = null; | ||
12 | + callFn.apply(this, arguments); | ||
13 | + }; | ||
14 | +} | ||
15 | +module.exports = exports["default"]; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/parallel.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = _parallel; | ||
7 | + | ||
8 | +var _noop = require('lodash/noop'); | ||
9 | + | ||
10 | +var _noop2 = _interopRequireDefault(_noop); | ||
11 | + | ||
12 | +var _isArrayLike = require('lodash/isArrayLike'); | ||
13 | + | ||
14 | +var _isArrayLike2 = _interopRequireDefault(_isArrayLike); | ||
15 | + | ||
16 | +var _slice = require('./slice'); | ||
17 | + | ||
18 | +var _slice2 = _interopRequireDefault(_slice); | ||
19 | + | ||
20 | +var _wrapAsync = require('./wrapAsync'); | ||
21 | + | ||
22 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
23 | + | ||
24 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
25 | + | ||
26 | +function _parallel(eachfn, tasks, callback) { | ||
27 | + callback = callback || _noop2.default; | ||
28 | + var results = (0, _isArrayLike2.default)(tasks) ? [] : {}; | ||
29 | + | ||
30 | + eachfn(tasks, function (task, key, callback) { | ||
31 | + (0, _wrapAsync2.default)(task)(function (err, result) { | ||
32 | + if (arguments.length > 2) { | ||
33 | + result = (0, _slice2.default)(arguments, 1); | ||
34 | + } | ||
35 | + results[key] = result; | ||
36 | + callback(err); | ||
37 | + }); | ||
38 | + }, function (err) { | ||
39 | + callback(err, results); | ||
40 | + }); | ||
41 | +} | ||
42 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/queue.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = queue; | ||
7 | + | ||
8 | +var _baseIndexOf = require('lodash/_baseIndexOf'); | ||
9 | + | ||
10 | +var _baseIndexOf2 = _interopRequireDefault(_baseIndexOf); | ||
11 | + | ||
12 | +var _isArray = require('lodash/isArray'); | ||
13 | + | ||
14 | +var _isArray2 = _interopRequireDefault(_isArray); | ||
15 | + | ||
16 | +var _noop = require('lodash/noop'); | ||
17 | + | ||
18 | +var _noop2 = _interopRequireDefault(_noop); | ||
19 | + | ||
20 | +var _onlyOnce = require('./onlyOnce'); | ||
21 | + | ||
22 | +var _onlyOnce2 = _interopRequireDefault(_onlyOnce); | ||
23 | + | ||
24 | +var _setImmediate = require('./setImmediate'); | ||
25 | + | ||
26 | +var _setImmediate2 = _interopRequireDefault(_setImmediate); | ||
27 | + | ||
28 | +var _DoublyLinkedList = require('./DoublyLinkedList'); | ||
29 | + | ||
30 | +var _DoublyLinkedList2 = _interopRequireDefault(_DoublyLinkedList); | ||
31 | + | ||
32 | +var _wrapAsync = require('./wrapAsync'); | ||
33 | + | ||
34 | +var _wrapAsync2 = _interopRequireDefault(_wrapAsync); | ||
35 | + | ||
36 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
37 | + | ||
38 | +function queue(worker, concurrency, payload) { | ||
39 | + if (concurrency == null) { | ||
40 | + concurrency = 1; | ||
41 | + } else if (concurrency === 0) { | ||
42 | + throw new Error('Concurrency must not be zero'); | ||
43 | + } | ||
44 | + | ||
45 | + var _worker = (0, _wrapAsync2.default)(worker); | ||
46 | + var numRunning = 0; | ||
47 | + var workersList = []; | ||
48 | + | ||
49 | + var processingScheduled = false; | ||
50 | + function _insert(data, insertAtFront, callback) { | ||
51 | + if (callback != null && typeof callback !== 'function') { | ||
52 | + throw new Error('task callback must be a function'); | ||
53 | + } | ||
54 | + q.started = true; | ||
55 | + if (!(0, _isArray2.default)(data)) { | ||
56 | + data = [data]; | ||
57 | + } | ||
58 | + if (data.length === 0 && q.idle()) { | ||
59 | + // call drain immediately if there are no tasks | ||
60 | + return (0, _setImmediate2.default)(function () { | ||
61 | + q.drain(); | ||
62 | + }); | ||
63 | + } | ||
64 | + | ||
65 | + for (var i = 0, l = data.length; i < l; i++) { | ||
66 | + var item = { | ||
67 | + data: data[i], | ||
68 | + callback: callback || _noop2.default | ||
69 | + }; | ||
70 | + | ||
71 | + if (insertAtFront) { | ||
72 | + q._tasks.unshift(item); | ||
73 | + } else { | ||
74 | + q._tasks.push(item); | ||
75 | + } | ||
76 | + } | ||
77 | + | ||
78 | + if (!processingScheduled) { | ||
79 | + processingScheduled = true; | ||
80 | + (0, _setImmediate2.default)(function () { | ||
81 | + processingScheduled = false; | ||
82 | + q.process(); | ||
83 | + }); | ||
84 | + } | ||
85 | + } | ||
86 | + | ||
87 | + function _next(tasks) { | ||
88 | + return function (err) { | ||
89 | + numRunning -= 1; | ||
90 | + | ||
91 | + for (var i = 0, l = tasks.length; i < l; i++) { | ||
92 | + var task = tasks[i]; | ||
93 | + | ||
94 | + var index = (0, _baseIndexOf2.default)(workersList, task, 0); | ||
95 | + if (index === 0) { | ||
96 | + workersList.shift(); | ||
97 | + } else if (index > 0) { | ||
98 | + workersList.splice(index, 1); | ||
99 | + } | ||
100 | + | ||
101 | + task.callback.apply(task, arguments); | ||
102 | + | ||
103 | + if (err != null) { | ||
104 | + q.error(err, task.data); | ||
105 | + } | ||
106 | + } | ||
107 | + | ||
108 | + if (numRunning <= q.concurrency - q.buffer) { | ||
109 | + q.unsaturated(); | ||
110 | + } | ||
111 | + | ||
112 | + if (q.idle()) { | ||
113 | + q.drain(); | ||
114 | + } | ||
115 | + q.process(); | ||
116 | + }; | ||
117 | + } | ||
118 | + | ||
119 | + var isProcessing = false; | ||
120 | + var q = { | ||
121 | + _tasks: new _DoublyLinkedList2.default(), | ||
122 | + concurrency: concurrency, | ||
123 | + payload: payload, | ||
124 | + saturated: _noop2.default, | ||
125 | + unsaturated: _noop2.default, | ||
126 | + buffer: concurrency / 4, | ||
127 | + empty: _noop2.default, | ||
128 | + drain: _noop2.default, | ||
129 | + error: _noop2.default, | ||
130 | + started: false, | ||
131 | + paused: false, | ||
132 | + push: function (data, callback) { | ||
133 | + _insert(data, false, callback); | ||
134 | + }, | ||
135 | + kill: function () { | ||
136 | + q.drain = _noop2.default; | ||
137 | + q._tasks.empty(); | ||
138 | + }, | ||
139 | + unshift: function (data, callback) { | ||
140 | + _insert(data, true, callback); | ||
141 | + }, | ||
142 | + remove: function (testFn) { | ||
143 | + q._tasks.remove(testFn); | ||
144 | + }, | ||
145 | + process: function () { | ||
146 | + // Avoid trying to start too many processing operations. This can occur | ||
147 | + // when callbacks resolve synchronously (#1267). | ||
148 | + if (isProcessing) { | ||
149 | + return; | ||
150 | + } | ||
151 | + isProcessing = true; | ||
152 | + while (!q.paused && numRunning < q.concurrency && q._tasks.length) { | ||
153 | + var tasks = [], | ||
154 | + data = []; | ||
155 | + var l = q._tasks.length; | ||
156 | + if (q.payload) l = Math.min(l, q.payload); | ||
157 | + for (var i = 0; i < l; i++) { | ||
158 | + var node = q._tasks.shift(); | ||
159 | + tasks.push(node); | ||
160 | + workersList.push(node); | ||
161 | + data.push(node.data); | ||
162 | + } | ||
163 | + | ||
164 | + numRunning += 1; | ||
165 | + | ||
166 | + if (q._tasks.length === 0) { | ||
167 | + q.empty(); | ||
168 | + } | ||
169 | + | ||
170 | + if (numRunning === q.concurrency) { | ||
171 | + q.saturated(); | ||
172 | + } | ||
173 | + | ||
174 | + var cb = (0, _onlyOnce2.default)(_next(tasks)); | ||
175 | + _worker(data, cb); | ||
176 | + } | ||
177 | + isProcessing = false; | ||
178 | + }, | ||
179 | + length: function () { | ||
180 | + return q._tasks.length; | ||
181 | + }, | ||
182 | + running: function () { | ||
183 | + return numRunning; | ||
184 | + }, | ||
185 | + workersList: function () { | ||
186 | + return workersList; | ||
187 | + }, | ||
188 | + idle: function () { | ||
189 | + return q._tasks.length + numRunning === 0; | ||
190 | + }, | ||
191 | + pause: function () { | ||
192 | + q.paused = true; | ||
193 | + }, | ||
194 | + resume: function () { | ||
195 | + if (q.paused === false) { | ||
196 | + return; | ||
197 | + } | ||
198 | + q.paused = false; | ||
199 | + (0, _setImmediate2.default)(q.process); | ||
200 | + } | ||
201 | + }; | ||
202 | + return q; | ||
203 | +} | ||
204 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/reject.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.default = reject; | ||
7 | + | ||
8 | +var _filter = require('./filter'); | ||
9 | + | ||
10 | +var _filter2 = _interopRequireDefault(_filter); | ||
11 | + | ||
12 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
13 | + | ||
14 | +function reject(eachfn, arr, iteratee, callback) { | ||
15 | + (0, _filter2.default)(eachfn, arr, function (value, cb) { | ||
16 | + iteratee(value, function (err, v) { | ||
17 | + cb(err, !v); | ||
18 | + }); | ||
19 | + }, callback); | ||
20 | +} | ||
21 | +module.exports = exports['default']; | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/setImmediate.js
0 → 100644
1 | +'use strict'; | ||
2 | + | ||
3 | +Object.defineProperty(exports, "__esModule", { | ||
4 | + value: true | ||
5 | +}); | ||
6 | +exports.hasNextTick = exports.hasSetImmediate = undefined; | ||
7 | +exports.fallback = fallback; | ||
8 | +exports.wrap = wrap; | ||
9 | + | ||
10 | +var _slice = require('./slice'); | ||
11 | + | ||
12 | +var _slice2 = _interopRequireDefault(_slice); | ||
13 | + | ||
14 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | ||
15 | + | ||
16 | +var hasSetImmediate = exports.hasSetImmediate = typeof setImmediate === 'function' && setImmediate; | ||
17 | +var hasNextTick = exports.hasNextTick = typeof process === 'object' && typeof process.nextTick === 'function'; | ||
18 | + | ||
19 | +function fallback(fn) { | ||
20 | + setTimeout(fn, 0); | ||
21 | +} | ||
22 | + | ||
23 | +function wrap(defer) { | ||
24 | + return function (fn /*, ...args*/) { | ||
25 | + var args = (0, _slice2.default)(arguments, 1); | ||
26 | + defer(function () { | ||
27 | + fn.apply(null, args); | ||
28 | + }); | ||
29 | + }; | ||
30 | +} | ||
31 | + | ||
32 | +var _defer; | ||
33 | + | ||
34 | +if (hasSetImmediate) { | ||
35 | + _defer = setImmediate; | ||
36 | +} else if (hasNextTick) { | ||
37 | + _defer = process.nextTick; | ||
38 | +} else { | ||
39 | + _defer = fallback; | ||
40 | +} | ||
41 | + | ||
42 | +exports.default = wrap(_defer); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
node_modules/async/internal/slice.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/internal/withoutIndex.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/internal/wrapAsync.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/log.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/map.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/mapLimit.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/mapSeries.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/mapValues.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/mapValuesLimit.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/mapValuesSeries.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/memoize.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/nextTick.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/package.json
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/parallel.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/parallelLimit.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/priorityQueue.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/queue.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/race.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/reduce.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/reduceRight.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/reflect.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/reflectAll.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/reject.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/rejectLimit.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/rejectSeries.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/retry.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/retryable.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/select.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/selectLimit.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/selectSeries.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/seq.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/series.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/setImmediate.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/some.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/someLimit.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/someSeries.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/sortBy.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/timeout.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/times.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/timesLimit.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/timesSeries.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/transform.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/tryEach.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/unmemoize.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/until.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/waterfall.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/whilst.js
0 → 100644
This diff is collapsed. Click to expand it.
node_modules/async/wrapSync.js
0 → 100644
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
-
Please register or login to post a comment