1 | (function (global, factory) {
|
2 | typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
|
3 | typeof define === 'function' && define.amd ? define(['exports'], factory) :
|
4 | (factory((global.async = global.async || {})));
|
5 | }(this, function (exports) { 'use strict';
|
6 |
|
7 | |
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 | function apply(func, thisArg, args) {
|
18 | var length = args.length;
|
19 | switch (length) {
|
20 | case 0: return func.call(thisArg);
|
21 | case 1: return func.call(thisArg, args[0]);
|
22 | case 2: return func.call(thisArg, args[0], args[1]);
|
23 | case 3: return func.call(thisArg, args[0], args[1], args[2]);
|
24 | }
|
25 | return func.apply(thisArg, args);
|
26 | }
|
27 |
|
28 | |
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 |
|
39 |
|
40 |
|
41 |
|
42 |
|
43 |
|
44 |
|
45 |
|
46 |
|
47 |
|
48 |
|
49 |
|
50 |
|
51 | function isObject(value) {
|
52 | var type = typeof value;
|
53 | return !!value && (type == 'object' || type == 'function');
|
54 | }
|
55 |
|
56 | var funcTag = '[object Function]';
|
57 | var genTag = '[object GeneratorFunction]';
|
58 |
|
59 | var objectProto = Object.prototype;
|
60 |
|
61 | |
62 |
|
63 |
|
64 |
|
65 | var objectToString = objectProto.toString;
|
66 |
|
67 | |
68 |
|
69 |
|
70 |
|
71 |
|
72 |
|
73 |
|
74 |
|
75 |
|
76 |
|
77 |
|
78 |
|
79 |
|
80 |
|
81 |
|
82 |
|
83 | function isFunction(value) {
|
84 |
|
85 |
|
86 |
|
87 | var tag = isObject(value) ? objectToString.call(value) : '';
|
88 | return tag == funcTag || tag == genTag;
|
89 | }
|
90 |
|
91 |
|
92 | var NAN = 0 / 0;
|
93 |
|
94 |
|
95 | var reTrim = /^\s+|\s+$/g;
|
96 |
|
97 |
|
98 | var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
|
99 |
|
100 |
|
101 | var reIsBinary = /^0b[01]+$/i;
|
102 |
|
103 |
|
104 | var reIsOctal = /^0o[0-7]+$/i;
|
105 |
|
106 |
|
107 | var freeParseInt = parseInt;
|
108 |
|
109 | |
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 |
|
123 |
|
124 |
|
125 |
|
126 |
|
127 |
|
128 |
|
129 |
|
130 |
|
131 | function toNumber(value) {
|
132 | if (isObject(value)) {
|
133 | var other = isFunction(value.valueOf) ? value.valueOf() : value;
|
134 | value = isObject(other) ? (other + '') : other;
|
135 | }
|
136 | if (typeof value != 'string') {
|
137 | return value === 0 ? value : +value;
|
138 | }
|
139 | value = value.replace(reTrim, '');
|
140 | var isBinary = reIsBinary.test(value);
|
141 | return (isBinary || reIsOctal.test(value))
|
142 | ? freeParseInt(value.slice(2), isBinary ? 2 : 8)
|
143 | : (reIsBadHex.test(value) ? NAN : +value);
|
144 | }
|
145 |
|
146 | var INFINITY = 1 / 0;
|
147 | var MAX_INTEGER = 1.7976931348623157e+308;
|
148 | |
149 |
|
150 |
|
151 |
|
152 |
|
153 |
|
154 |
|
155 |
|
156 |
|
157 |
|
158 |
|
159 |
|
160 |
|
161 |
|
162 |
|
163 |
|
164 |
|
165 |
|
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 | function toInteger(value) {
|
173 | if (!value) {
|
174 | return value === 0 ? value : 0;
|
175 | }
|
176 | value = toNumber(value);
|
177 | if (value === INFINITY || value === -INFINITY) {
|
178 | var sign = (value < 0 ? -1 : 1);
|
179 | return sign * MAX_INTEGER;
|
180 | }
|
181 | var remainder = value % 1;
|
182 | return value === value ? (remainder ? value - remainder : value) : 0;
|
183 | }
|
184 |
|
185 |
|
186 | var FUNC_ERROR_TEXT = 'Expected a function';
|
187 |
|
188 |
|
189 | var nativeMax = Math.max;
|
190 |
|
191 | |
192 |
|
193 |
|
194 |
|
195 |
|
196 |
|
197 |
|
198 |
|
199 |
|
200 |
|
201 |
|
202 |
|
203 |
|
204 |
|
205 |
|
206 |
|
207 |
|
208 |
|
209 |
|
210 |
|
211 |
|
212 |
|
213 | function rest(func, start) {
|
214 | if (typeof func != 'function') {
|
215 | throw new TypeError(FUNC_ERROR_TEXT);
|
216 | }
|
217 | start = nativeMax(start === undefined ? (func.length - 1) : toInteger(start), 0);
|
218 | return function() {
|
219 | var args = arguments,
|
220 | index = -1,
|
221 | length = nativeMax(args.length - start, 0),
|
222 | array = Array(length);
|
223 |
|
224 | while (++index < length) {
|
225 | array[index] = args[start + index];
|
226 | }
|
227 | switch (start) {
|
228 | case 0: return func.call(this, array);
|
229 | case 1: return func.call(this, args[0], array);
|
230 | case 2: return func.call(this, args[0], args[1], array);
|
231 | }
|
232 | var otherArgs = Array(start + 1);
|
233 | index = -1;
|
234 | while (++index < start) {
|
235 | otherArgs[index] = args[index];
|
236 | }
|
237 | otherArgs[start] = array;
|
238 | return apply(func, this, otherArgs);
|
239 | };
|
240 | }
|
241 |
|
242 | function initialParams (fn) {
|
243 | return rest(function (args /*..., callback*/) {
|
244 | var callback = args.pop();
|
245 | fn(args, callback);
|
246 | });
|
247 | }
|
248 |
|
249 | function applyEach$1(eachfn) {
|
250 | return rest(function (fns, args) {
|
251 | var go = initialParams(function (args, callback) {
|
252 | var that = this;
|
253 | return eachfn(fns, function (fn, _, cb) {
|
254 | fn.apply(that, args.concat([cb]));
|
255 | }, callback);
|
256 | });
|
257 | if (args.length) {
|
258 | return go.apply(this, args);
|
259 | } else {
|
260 | return go;
|
261 | }
|
262 | });
|
263 | }
|
264 |
|
265 | |
266 |
|
267 |
|
268 |
|
269 |
|
270 |
|
271 |
|
272 |
|
273 |
|
274 |
|
275 |
|
276 |
|
277 |
|
278 |
|
279 | function noop() {
|
280 |
|
281 | }
|
282 |
|
283 |
|
284 | var FUNC_ERROR_TEXT$1 = 'Expected a function';
|
285 |
|
286 | |
287 |
|
288 |
|
289 |
|
290 |
|
291 |
|
292 |
|
293 |
|
294 |
|
295 |
|
296 |
|
297 |
|
298 |
|
299 |
|
300 |
|
301 |
|
302 | function before(n, func) {
|
303 | var result;
|
304 | if (typeof func != 'function') {
|
305 | throw new TypeError(FUNC_ERROR_TEXT$1);
|
306 | }
|
307 | n = toInteger(n);
|
308 | return function() {
|
309 | if (--n > 0) {
|
310 | result = func.apply(this, arguments);
|
311 | }
|
312 | if (n <= 1) {
|
313 | func = undefined;
|
314 | }
|
315 | return result;
|
316 | };
|
317 | }
|
318 |
|
319 | |
320 |
|
321 |
|
322 |
|
323 |
|
324 |
|
325 |
|
326 |
|
327 |
|
328 |
|
329 |
|
330 |
|
331 |
|
332 |
|
333 |
|
334 |
|
335 |
|
336 | function once(func) {
|
337 | return before(2, func);
|
338 | }
|
339 |
|
340 | |
341 |
|
342 |
|
343 |
|
344 |
|
345 |
|
346 |
|
347 | function baseProperty(key) {
|
348 | return function(object) {
|
349 | return object == null ? undefined : object[key];
|
350 | };
|
351 | }
|
352 |
|
353 | |
354 |
|
355 |
|
356 |
|
357 |
|
358 |
|
359 |
|
360 |
|
361 |
|
362 |
|
363 | var getLength = baseProperty('length');
|
364 |
|
365 |
|
366 | var MAX_SAFE_INTEGER = 9007199254740991;
|
367 |
|
368 | |
369 |
|
370 |
|
371 |
|
372 |
|
373 |
|
374 |
|
375 |
|
376 |
|
377 |
|
378 |
|
379 |
|
380 |
|
381 |
|
382 |
|
383 |
|
384 |
|
385 |
|
386 |
|
387 |
|
388 |
|
389 |
|
390 |
|
391 |
|
392 | function isLength(value) {
|
393 | return typeof value == 'number' &&
|
394 | value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
|
395 | }
|
396 |
|
397 | |
398 |
|
399 |
|
400 |
|
401 |
|
402 |
|
403 |
|
404 |
|
405 |
|
406 |
|
407 |
|
408 |
|
409 |
|
410 |
|
411 |
|
412 |
|
413 |
|
414 |
|
415 |
|
416 |
|
417 |
|
418 |
|
419 |
|
420 |
|
421 | function isArrayLike(value) {
|
422 | return value != null && isLength(getLength(value)) && !isFunction(value);
|
423 | }
|
424 |
|
425 | var iteratorSymbol = typeof Symbol === 'function' && Symbol.iterator;
|
426 |
|
427 | function getIterator (coll) {
|
428 | return iteratorSymbol && coll[iteratorSymbol] && coll[iteratorSymbol]();
|
429 | }
|
430 |
|
431 |
|
432 | var objectProto$1 = Object.prototype;
|
433 |
|
434 |
|
435 | var hasOwnProperty = objectProto$1.hasOwnProperty;
|
436 |
|
437 |
|
438 | var getPrototypeOf = Object.getPrototypeOf;
|
439 |
|
440 | |
441 |
|
442 |
|
443 |
|
444 |
|
445 |
|
446 |
|
447 |
|
448 | function baseHas(object, key) {
|
449 |
|
450 |
|
451 |
|
452 | return hasOwnProperty.call(object, key) ||
|
453 | (typeof object == 'object' && key in object && getPrototypeOf(object) === null);
|
454 | }
|
455 |
|
456 |
|
457 | var nativeKeys = Object.keys;
|
458 |
|
459 | |
460 |
|
461 |
|
462 |
|
463 |
|
464 |
|
465 |
|
466 |
|
467 | function baseKeys(object) {
|
468 | return nativeKeys(Object(object));
|
469 | }
|
470 |
|
471 | |
472 |
|
473 |
|
474 |
|
475 |
|
476 |
|
477 |
|
478 |
|
479 |
|
480 | function baseTimes(n, iteratee) {
|
481 | var index = -1,
|
482 | result = Array(n);
|
483 |
|
484 | while (++index < n) {
|
485 | result[index] = iteratee(index);
|
486 | }
|
487 | return result;
|
488 | }
|
489 |
|
490 | |
491 |
|
492 |
|
493 |
|
494 |
|
495 |
|
496 |
|
497 |
|
498 |
|
499 |
|
500 |
|
501 |
|
502 |
|
503 |
|
504 |
|
505 |
|
506 |
|
507 |
|
508 |
|
509 |
|
510 |
|
511 |
|
512 |
|
513 | function isObjectLike(value) {
|
514 | return !!value && typeof value == 'object';
|
515 | }
|
516 |
|
517 | |
518 |
|
519 |
|
520 |
|
521 |
|
522 |
|
523 |
|
524 |
|
525 |
|
526 |
|
527 |
|
528 |
|
529 |
|
530 |
|
531 |
|
532 |
|
533 |
|
534 |
|
535 |
|
536 |
|
537 |
|
538 |
|
539 |
|
540 | function isArrayLikeObject(value) {
|
541 | return isObjectLike(value) && isArrayLike(value);
|
542 | }
|
543 |
|
544 |
|
545 | var argsTag = '[object Arguments]';
|
546 |
|
547 |
|
548 | var objectProto$2 = Object.prototype;
|
549 |
|
550 |
|
551 | var hasOwnProperty$1 = objectProto$2.hasOwnProperty;
|
552 |
|
553 | |
554 |
|
555 |
|
556 |
|
557 | var objectToString$1 = objectProto$2.toString;
|
558 |
|
559 |
|
560 | var propertyIsEnumerable = objectProto$2.propertyIsEnumerable;
|
561 |
|
562 | |
563 |
|
564 |
|
565 |
|
566 |
|
567 |
|
568 |
|
569 |
|
570 |
|
571 |
|
572 |
|
573 |
|
574 |
|
575 |
|
576 |
|
577 |
|
578 | function isArguments(value) {
|
579 |
|
580 | return isArrayLikeObject(value) && hasOwnProperty$1.call(value, 'callee') &&
|
581 | (!propertyIsEnumerable.call(value, 'callee') || objectToString$1.call(value) == argsTag);
|
582 | }
|
583 |
|
584 | |
585 |
|
586 |
|
587 |
|
588 |
|
589 |
|
590 |
|
591 |
|
592 |
|
593 |
|
594 |
|
595 |
|
596 |
|
597 |
|
598 |
|
599 |
|
600 |
|
601 |
|
602 |
|
603 |
|
604 |
|
605 |
|
606 |
|
607 | var isArray = Array.isArray;
|
608 |
|
609 |
|
610 | var stringTag = '[object String]';
|
611 |
|
612 |
|
613 | var objectProto$3 = Object.prototype;
|
614 |
|
615 | |
616 |
|
617 |
|
618 |
|
619 | var objectToString$2 = objectProto$3.toString;
|
620 |
|
621 | |
622 |
|
623 |
|
624 |
|
625 |
|
626 |
|
627 |
|
628 |
|
629 |
|
630 |
|
631 |
|
632 |
|
633 |
|
634 |
|
635 |
|
636 |
|
637 | function isString(value) {
|
638 | return typeof value == 'string' ||
|
639 | (!isArray(value) && isObjectLike(value) && objectToString$2.call(value) == stringTag);
|
640 | }
|
641 |
|
642 | |
643 |
|
644 |
|
645 |
|
646 |
|
647 |
|
648 |
|
649 |
|
650 | function indexKeys(object) {
|
651 | var length = object ? object.length : undefined;
|
652 | if (isLength(length) &&
|
653 | (isArray(object) || isString(object) || isArguments(object))) {
|
654 | return baseTimes(length, String);
|
655 | }
|
656 | return null;
|
657 | }
|
658 |
|
659 |
|
660 | var MAX_SAFE_INTEGER$1 = 9007199254740991;
|
661 |
|
662 |
|
663 | var reIsUint = /^(?:0|[1-9]\d*)$/;
|
664 |
|
665 | |
666 |
|
667 |
|
668 |
|
669 |
|
670 |
|
671 |
|
672 |
|
673 | function isIndex(value, length) {
|
674 | value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1;
|
675 | length = length == null ? MAX_SAFE_INTEGER$1 : length;
|
676 | return value > -1 && value % 1 == 0 && value < length;
|
677 | }
|
678 |
|
679 |
|
680 | var objectProto$4 = Object.prototype;
|
681 |
|
682 | |
683 |
|
684 |
|
685 |
|
686 |
|
687 |
|
688 |
|
689 | function isPrototype(value) {
|
690 | var Ctor = value && value.constructor,
|
691 | proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto$4;
|
692 |
|
693 | return value === proto;
|
694 | }
|
695 |
|
696 | |
697 |
|
698 |
|
699 |
|
700 |
|
701 |
|
702 |
|
703 |
|
704 |
|
705 |
|
706 |
|
707 |
|
708 |
|
709 |
|
710 |
|
711 |
|
712 |
|
713 |
|
714 |
|
715 |
|
716 |
|
717 |
|
718 |
|
719 |
|
720 |
|
721 |
|
722 |
|
723 | function keys(object) {
|
724 | var isProto = isPrototype(object);
|
725 | if (!(isProto || isArrayLike(object))) {
|
726 | return baseKeys(object);
|
727 | }
|
728 | var indexes = indexKeys(object),
|
729 | skipIndexes = !!indexes,
|
730 | result = indexes || [],
|
731 | length = result.length;
|
732 |
|
733 | for (var key in object) {
|
734 | if (baseHas(object, key) &&
|
735 | !(skipIndexes && (key == 'length' || isIndex(key, length))) &&
|
736 | !(isProto && key == 'constructor')) {
|
737 | result.push(key);
|
738 | }
|
739 | }
|
740 | return result;
|
741 | }
|
742 |
|
743 | function iterator(coll) {
|
744 | var i = -1;
|
745 | var len;
|
746 | if (isArrayLike(coll)) {
|
747 | len = coll.length;
|
748 | return function next() {
|
749 | i++;
|
750 | return i < len ? { value: coll[i], key: i } : null;
|
751 | };
|
752 | }
|
753 |
|
754 | var iterate = getIterator(coll);
|
755 | if (iterate) {
|
756 | return function next() {
|
757 | var item = iterate.next();
|
758 | if (item.done) return null;
|
759 | i++;
|
760 | return { value: item.value, key: i };
|
761 | };
|
762 | }
|
763 |
|
764 | var okeys = keys(coll);
|
765 | len = okeys.length;
|
766 | return function next() {
|
767 | i++;
|
768 | var key = okeys[i];
|
769 | return i < len ? { value: coll[key], key: key } : null;
|
770 | };
|
771 | }
|
772 |
|
773 | function onlyOnce(fn) {
|
774 | return function () {
|
775 | if (fn === null) throw new Error("Callback was already called.");
|
776 | fn.apply(this, arguments);
|
777 | fn = null;
|
778 | };
|
779 | }
|
780 |
|
781 | function _eachOfLimit(limit) {
|
782 | return function (obj, iteratee, callback) {
|
783 | callback = once(callback || noop);
|
784 | obj = obj || [];
|
785 | var nextElem = iterator(obj);
|
786 | if (limit <= 0) {
|
787 | return callback(null);
|
788 | }
|
789 | var done = false;
|
790 | var running = 0;
|
791 | var errored = false;
|
792 |
|
793 | (function replenish() {
|
794 | if (done && running <= 0) {
|
795 | return callback(null);
|
796 | }
|
797 |
|
798 | while (running < limit && !errored) {
|
799 | var elem = nextElem();
|
800 | if (elem === null) {
|
801 | done = true;
|
802 | if (running <= 0) {
|
803 | callback(null);
|
804 | }
|
805 | return;
|
806 | }
|
807 | running += 1;
|
808 | iteratee(elem.value, elem.key, onlyOnce(function (err) {
|
809 | running -= 1;
|
810 | if (err) {
|
811 | callback(err);
|
812 | errored = true;
|
813 | } else {
|
814 | replenish();
|
815 | }
|
816 | }));
|
817 | }
|
818 | })();
|
819 | };
|
820 | }
|
821 |
|
822 | function eachOfLimit(obj, limit, iteratee, cb) {
|
823 | _eachOfLimit(limit)(obj, iteratee, cb);
|
824 | }
|
825 |
|
826 | function doLimit(fn, limit) {
|
827 | return function (iterable, iteratee, callback) {
|
828 | return fn(iterable, limit, iteratee, callback);
|
829 | };
|
830 | }
|
831 |
|
832 | var eachOf = doLimit(eachOfLimit, Infinity);
|
833 |
|
834 | var applyEach = applyEach$1(eachOf);
|
835 |
|
836 | var eachOfSeries = doLimit(eachOfLimit, 1);
|
837 |
|
838 | var applyEachSeries = applyEach$1(eachOfSeries);
|
839 |
|
840 | var apply$1 = rest(function (fn, args) {
|
841 | return rest(function (callArgs) {
|
842 | return fn.apply(null, args.concat(callArgs));
|
843 | });
|
844 | });
|
845 |
|
846 | function asyncify(func) {
|
847 | return initialParams(function (args, callback) {
|
848 | var result;
|
849 | try {
|
850 | result = func.apply(this, args);
|
851 | } catch (e) {
|
852 | return callback(e);
|
853 | }
|
854 |
|
855 | if (isObject(result) && typeof result.then === 'function') {
|
856 | result.then(function (value) {
|
857 | callback(null, value);
|
858 | })['catch'](function (err) {
|
859 | callback(err.message ? err : new Error(err));
|
860 | });
|
861 | } else {
|
862 | callback(null, result);
|
863 | }
|
864 | });
|
865 | }
|
866 |
|
867 | |
868 |
|
869 |
|
870 |
|
871 |
|
872 |
|
873 |
|
874 |
|
875 |
|
876 | function arrayEach(array, iteratee) {
|
877 | var index = -1,
|
878 | length = array.length;
|
879 |
|
880 | while (++index < length) {
|
881 | if (iteratee(array[index], index, array) === false) {
|
882 | break;
|
883 | }
|
884 | }
|
885 | return array;
|
886 | }
|
887 |
|
888 | |
889 |
|
890 |
|
891 |
|
892 |
|
893 |
|
894 |
|
895 |
|
896 |
|
897 |
|
898 |
|
899 |
|
900 |
|
901 |
|
902 |
|
903 | function identity(value) {
|
904 | return value;
|
905 | }
|
906 |
|
907 | |
908 |
|
909 |
|
910 |
|
911 |
|
912 |
|
913 |
|
914 | function baseCastFunction(value) {
|
915 | return typeof value == 'function' ? value : identity;
|
916 | }
|
917 |
|
918 | |
919 |
|
920 |
|
921 |
|
922 |
|
923 |
|
924 |
|
925 | function createBaseFor(fromRight) {
|
926 | return function(object, iteratee, keysFunc) {
|
927 | var index = -1,
|
928 | iterable = Object(object),
|
929 | props = keysFunc(object),
|
930 | length = props.length;
|
931 |
|
932 | while (length--) {
|
933 | var key = props[fromRight ? length : ++index];
|
934 | if (iteratee(iterable[key], key, iterable) === false) {
|
935 | break;
|
936 | }
|
937 | }
|
938 | return object;
|
939 | };
|
940 | }
|
941 |
|
942 | |
943 |
|
944 |
|
945 |
|
946 |
|
947 |
|
948 |
|
949 |
|
950 |
|
951 |
|
952 |
|
953 |
|
954 | var baseFor = createBaseFor();
|
955 |
|
956 | |
957 |
|
958 |
|
959 |
|
960 |
|
961 |
|
962 |
|
963 |
|
964 | function baseForOwn(object, iteratee) {
|
965 | return object && baseFor(object, iteratee, keys);
|
966 | }
|
967 |
|
968 | |
969 |
|
970 |
|
971 |
|
972 |
|
973 |
|
974 |
|
975 |
|
976 |
|
977 |
|
978 |
|
979 |
|
980 |
|
981 |
|
982 |
|
983 |
|
984 |
|
985 |
|
986 |
|
987 |
|
988 |
|
989 |
|
990 |
|
991 |
|
992 |
|
993 |
|
994 | function forOwn(object, iteratee) {
|
995 | return object && baseForOwn(object, baseCastFunction(iteratee));
|
996 | }
|
997 |
|
998 | |
999 |
|
1000 |
|
1001 |
|
1002 |
|
1003 |
|
1004 |
|
1005 |
|
1006 |
|
1007 | function indexOfNaN(array, fromIndex, fromRight) {
|
1008 | var length = array.length,
|
1009 | index = fromIndex + (fromRight ? 0 : -1);
|
1010 |
|
1011 | while ((fromRight ? index-- : ++index < length)) {
|
1012 | var other = array[index];
|
1013 | if (other !== other) {
|
1014 | return index;
|
1015 | }
|
1016 | }
|
1017 | return -1;
|
1018 | }
|
1019 |
|
1020 | |
1021 |
|
1022 |
|
1023 |
|
1024 |
|
1025 |
|
1026 |
|
1027 |
|
1028 |
|
1029 | function baseIndexOf(array, value, fromIndex) {
|
1030 | if (value !== value) {
|
1031 | return indexOfNaN(array, fromIndex);
|
1032 | }
|
1033 | var index = fromIndex - 1,
|
1034 | length = array.length;
|
1035 |
|
1036 | while (++index < length) {
|
1037 | if (array[index] === value) {
|
1038 | return index;
|
1039 | }
|
1040 | }
|
1041 | return -1;
|
1042 | }
|
1043 |
|
1044 |
|
1045 | var nativeMax$1 = Math.max;
|
1046 |
|
1047 | |
1048 |
|
1049 |
|
1050 |
|
1051 |
|
1052 |
|
1053 |
|
1054 |
|
1055 |
|
1056 |
|
1057 |
|
1058 |
|
1059 |
|
1060 |
|
1061 |
|
1062 |
|
1063 |
|
1064 |
|
1065 |
|
1066 |
|
1067 |
|
1068 |
|
1069 | function indexOf(array, value, fromIndex) {
|
1070 | var length = array ? array.length : 0;
|
1071 | if (!length) {
|
1072 | return -1;
|
1073 | }
|
1074 | fromIndex = toInteger(fromIndex);
|
1075 | if (fromIndex < 0) {
|
1076 | fromIndex = nativeMax$1(length + fromIndex, 0);
|
1077 | }
|
1078 | return baseIndexOf(array, value, fromIndex);
|
1079 | }
|
1080 |
|
1081 | function auto (tasks, concurrency, callback) {
|
1082 | if (typeof concurrency === 'function') {
|
1083 |
|
1084 | callback = concurrency;
|
1085 | concurrency = null;
|
1086 | }
|
1087 | callback = once(callback || noop);
|
1088 | var keys$$ = keys(tasks);
|
1089 | var numTasks = keys$$.length;
|
1090 | if (!numTasks) {
|
1091 | return callback(null);
|
1092 | }
|
1093 | if (!concurrency) {
|
1094 | concurrency = numTasks;
|
1095 | }
|
1096 |
|
1097 | var results = {};
|
1098 | var runningTasks = 0;
|
1099 | var hasError = false;
|
1100 |
|
1101 | var listeners = {};
|
1102 |
|
1103 | var readyTasks = [];
|
1104 |
|
1105 | forOwn(tasks, function (task, key) {
|
1106 | if (!isArray(task)) {
|
1107 |
|
1108 | enqueueTask(key, [task]);
|
1109 | return;
|
1110 | }
|
1111 |
|
1112 | var dependencies = task.slice(0, task.length - 1);
|
1113 | var remainingDependencies = dependencies.length;
|
1114 |
|
1115 | checkForDeadlocks();
|
1116 |
|
1117 | function checkForDeadlocks() {
|
1118 | var len = dependencies.length;
|
1119 | var dep;
|
1120 | while (len--) {
|
1121 | if (!(dep = tasks[dependencies[len]])) {
|
1122 | throw new Error('async.auto task `' + key + '` has non-existent dependency in ' + dependencies.join(', '));
|
1123 | }
|
1124 | if (isArray(dep) && indexOf(dep, key) >= 0) {
|
1125 | throw new Error('async.auto task `' + key + '`Has cyclic dependencies');
|
1126 | }
|
1127 | }
|
1128 | }
|
1129 |
|
1130 | arrayEach(dependencies, function (dependencyName) {
|
1131 | addListener(dependencyName, function () {
|
1132 | remainingDependencies--;
|
1133 | if (remainingDependencies === 0) {
|
1134 | enqueueTask(key, task);
|
1135 | }
|
1136 | });
|
1137 | });
|
1138 | });
|
1139 |
|
1140 | processQueue();
|
1141 |
|
1142 | function enqueueTask(key, task) {
|
1143 | readyTasks.push(function () {
|
1144 | runTask(key, task);
|
1145 | });
|
1146 | }
|
1147 |
|
1148 | function processQueue() {
|
1149 | if (readyTasks.length === 0 && runningTasks === 0) {
|
1150 | return callback(null, results);
|
1151 | }
|
1152 | while (readyTasks.length && runningTasks < concurrency) {
|
1153 | var run = readyTasks.shift();
|
1154 | run();
|
1155 | }
|
1156 | }
|
1157 |
|
1158 | function addListener(taskName, fn) {
|
1159 | var taskListeners = listeners[taskName];
|
1160 | if (!taskListeners) {
|
1161 | taskListeners = listeners[taskName] = [];
|
1162 | }
|
1163 |
|
1164 | taskListeners.push(fn);
|
1165 | }
|
1166 |
|
1167 | function taskComplete(taskName) {
|
1168 | var taskListeners = listeners[taskName] || [];
|
1169 | arrayEach(taskListeners, function (fn) {
|
1170 | fn();
|
1171 | });
|
1172 | processQueue();
|
1173 | }
|
1174 |
|
1175 | function runTask(key, task) {
|
1176 | if (hasError) return;
|
1177 |
|
1178 | var taskCallback = onlyOnce(rest(function (err, args) {
|
1179 | runningTasks--;
|
1180 | if (args.length <= 1) {
|
1181 | args = args[0];
|
1182 | }
|
1183 | if (err) {
|
1184 | var safeResults = {};
|
1185 | forOwn(results, function (val, rkey) {
|
1186 | safeResults[rkey] = val;
|
1187 | });
|
1188 | safeResults[key] = args;
|
1189 | hasError = true;
|
1190 | listeners = [];
|
1191 |
|
1192 | callback(err, safeResults);
|
1193 | } else {
|
1194 | results[key] = args;
|
1195 | taskComplete(key);
|
1196 | }
|
1197 | }));
|
1198 |
|
1199 | runningTasks++;
|
1200 | var taskFn = task[task.length - 1];
|
1201 | if (task.length > 1) {
|
1202 | taskFn(results, taskCallback);
|
1203 | } else {
|
1204 | taskFn(taskCallback);
|
1205 | }
|
1206 | }
|
1207 | }
|
1208 |
|
1209 | |
1210 |
|
1211 |
|
1212 |
|
1213 |
|
1214 |
|
1215 |
|
1216 |
|
1217 |
|
1218 | function arrayMap(array, iteratee) {
|
1219 | var index = -1,
|
1220 | length = array.length,
|
1221 | result = Array(length);
|
1222 |
|
1223 | while (++index < length) {
|
1224 | result[index] = iteratee(array[index], index, array);
|
1225 | }
|
1226 | return result;
|
1227 | }
|
1228 |
|
1229 | |
1230 |
|
1231 |
|
1232 |
|
1233 |
|
1234 |
|
1235 |
|
1236 | function stackClear() {
|
1237 | this.__data__ = { 'array': [], 'map': null };
|
1238 | }
|
1239 |
|
1240 | |
1241 |
|
1242 |
|
1243 |
|
1244 |
|
1245 |
|
1246 |
|
1247 |
|
1248 |
|
1249 |
|
1250 |
|
1251 |
|
1252 |
|
1253 |
|
1254 |
|
1255 |
|
1256 |
|
1257 |
|
1258 |
|
1259 |
|
1260 |
|
1261 |
|
1262 |
|
1263 |
|
1264 |
|
1265 |
|
1266 |
|
1267 |
|
1268 |
|
1269 |
|
1270 | function eq(value, other) {
|
1271 | return value === other || (value !== value && other !== other);
|
1272 | }
|
1273 |
|
1274 | |
1275 |
|
1276 |
|
1277 |
|
1278 |
|
1279 |
|
1280 |
|
1281 |
|
1282 |
|
1283 | function assocIndexOf(array, key) {
|
1284 | var length = array.length;
|
1285 | while (length--) {
|
1286 | if (eq(array[length][0], key)) {
|
1287 | return length;
|
1288 | }
|
1289 | }
|
1290 | return -1;
|
1291 | }
|
1292 |
|
1293 |
|
1294 | var arrayProto = Array.prototype;
|
1295 |
|
1296 |
|
1297 | var splice = arrayProto.splice;
|
1298 |
|
1299 | |
1300 |
|
1301 |
|
1302 |
|
1303 |
|
1304 |
|
1305 |
|
1306 |
|
1307 | function assocDelete(array, key) {
|
1308 | var index = assocIndexOf(array, key);
|
1309 | if (index < 0) {
|
1310 | return false;
|
1311 | }
|
1312 | var lastIndex = array.length - 1;
|
1313 | if (index == lastIndex) {
|
1314 | array.pop();
|
1315 | } else {
|
1316 | splice.call(array, index, 1);
|
1317 | }
|
1318 | return true;
|
1319 | }
|
1320 |
|
1321 | |
1322 |
|
1323 |
|
1324 |
|
1325 |
|
1326 |
|
1327 |
|
1328 |
|
1329 |
|
1330 | function stackDelete(key) {
|
1331 | var data = this.__data__,
|
1332 | array = data.array;
|
1333 |
|
1334 | return array ? assocDelete(array, key) : data.map['delete'](key);
|
1335 | }
|
1336 |
|
1337 | |
1338 |
|
1339 |
|
1340 |
|
1341 |
|
1342 |
|
1343 |
|
1344 |
|
1345 | function assocGet(array, key) {
|
1346 | var index = assocIndexOf(array, key);
|
1347 | return index < 0 ? undefined : array[index][1];
|
1348 | }
|
1349 |
|
1350 | |
1351 |
|
1352 |
|
1353 |
|
1354 |
|
1355 |
|
1356 |
|
1357 |
|
1358 |
|
1359 | function stackGet(key) {
|
1360 | var data = this.__data__,
|
1361 | array = data.array;
|
1362 |
|
1363 | return array ? assocGet(array, key) : data.map.get(key);
|
1364 | }
|
1365 |
|
1366 | |
1367 |
|
1368 |
|
1369 |
|
1370 |
|
1371 |
|
1372 |
|
1373 |
|
1374 | function assocHas(array, key) {
|
1375 | return assocIndexOf(array, key) > -1;
|
1376 | }
|
1377 |
|
1378 | |
1379 |
|
1380 |
|
1381 |
|
1382 |
|
1383 |
|
1384 |
|
1385 |
|
1386 |
|
1387 | function stackHas(key) {
|
1388 | var data = this.__data__,
|
1389 | array = data.array;
|
1390 |
|
1391 | return array ? assocHas(array, key) : data.map.has(key);
|
1392 | }
|
1393 |
|
1394 | |
1395 |
|
1396 |
|
1397 |
|
1398 |
|
1399 |
|
1400 |
|
1401 | function isHostObject(value) {
|
1402 |
|
1403 |
|
1404 | var result = false;
|
1405 | if (value != null && typeof value.toString != 'function') {
|
1406 | try {
|
1407 | result = !!(value + '');
|
1408 | } catch (e) {}
|
1409 | }
|
1410 | return result;
|
1411 | }
|
1412 |
|
1413 |
|
1414 | var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
|
1415 |
|
1416 |
|
1417 | var reIsHostCtor = /^\[object .+?Constructor\]$/;
|
1418 |
|
1419 |
|
1420 | var objectProto$6 = Object.prototype;
|
1421 |
|
1422 |
|
1423 | var funcToString = Function.prototype.toString;
|
1424 |
|
1425 |
|
1426 | var hasOwnProperty$2 = objectProto$6.hasOwnProperty;
|
1427 |
|
1428 |
|
1429 | var reIsNative = RegExp('^' +
|
1430 | funcToString.call(hasOwnProperty$2).replace(reRegExpChar, '\\$&')
|
1431 | .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$'
|
1432 | );
|
1433 |
|
1434 | |
1435 |
|
1436 |
|
1437 |
|
1438 |
|
1439 |
|
1440 |
|
1441 |
|
1442 |
|
1443 |
|
1444 |
|
1445 |
|
1446 |
|
1447 |
|
1448 |
|
1449 |
|
1450 | function isNative(value) {
|
1451 | if (value == null) {
|
1452 | return false;
|
1453 | }
|
1454 | if (isFunction(value)) {
|
1455 | return reIsNative.test(funcToString.call(value));
|
1456 | }
|
1457 | return isObjectLike(value) &&
|
1458 | (isHostObject(value) ? reIsNative : reIsHostCtor).test(value);
|
1459 | }
|
1460 |
|
1461 | |
1462 |
|
1463 |
|
1464 |
|
1465 |
|
1466 |
|
1467 |
|
1468 |
|
1469 | function getNative(object, key) {
|
1470 | var value = object[key];
|
1471 | return isNative(value) ? value : undefined;
|
1472 | }
|
1473 |
|
1474 |
|
1475 | var nativeCreate = getNative(Object, 'create');
|
1476 |
|
1477 |
|
1478 | var objectProto$5 = Object.prototype;
|
1479 |
|
1480 | |
1481 |
|
1482 |
|
1483 |
|
1484 |
|
1485 |
|
1486 |
|
1487 | function Hash() {}
|
1488 |
|
1489 |
|
1490 | Hash.prototype = nativeCreate ? nativeCreate(null) : objectProto$5;
|
1491 |
|
1492 | |
1493 |
|
1494 |
|
1495 |
|
1496 |
|
1497 |
|
1498 |
|
1499 | function checkGlobal(value) {
|
1500 | return (value && value.Object === Object) ? value : null;
|
1501 | }
|
1502 |
|
1503 |
|
1504 | var objectTypes = {
|
1505 | 'function': true,
|
1506 | 'object': true
|
1507 | };
|
1508 |
|
1509 |
|
1510 | var freeExports = (objectTypes[typeof exports] && exports && !exports.nodeType)
|
1511 | ? exports
|
1512 | : undefined;
|
1513 |
|
1514 |
|
1515 | var freeModule = (objectTypes[typeof module] && module && !module.nodeType)
|
1516 | ? module
|
1517 | : undefined;
|
1518 |
|
1519 |
|
1520 | var freeGlobal = checkGlobal(freeExports && freeModule && typeof global == 'object' && global);
|
1521 |
|
1522 |
|
1523 | var freeSelf = checkGlobal(objectTypes[typeof self] && self);
|
1524 |
|
1525 |
|
1526 | var freeWindow = checkGlobal(objectTypes[typeof window] && window);
|
1527 |
|
1528 |
|
1529 | var thisGlobal = checkGlobal(objectTypes[typeof this] && this);
|
1530 |
|
1531 | |
1532 |
|
1533 |
|
1534 |
|
1535 |
|
1536 |
|
1537 | var root = freeGlobal ||
|
1538 | ((freeWindow !== (thisGlobal && thisGlobal.window)) && freeWindow) ||
|
1539 | freeSelf || thisGlobal || Function('return this')();
|
1540 |
|
1541 |
|
1542 | var Map = getNative(root, 'Map');
|
1543 |
|
1544 | |
1545 |
|
1546 |
|
1547 |
|
1548 |
|
1549 |
|
1550 |
|
1551 | function mapClear() {
|
1552 | this.__data__ = {
|
1553 | 'hash': new Hash,
|
1554 | 'map': Map ? new Map : [],
|
1555 | 'string': new Hash
|
1556 | };
|
1557 | }
|
1558 |
|
1559 |
|
1560 | var objectProto$7 = Object.prototype;
|
1561 |
|
1562 |
|
1563 | var hasOwnProperty$3 = objectProto$7.hasOwnProperty;
|
1564 |
|
1565 | |
1566 |
|
1567 |
|
1568 |
|
1569 |
|
1570 |
|
1571 |
|
1572 |
|
1573 | function hashHas(hash, key) {
|
1574 | return nativeCreate ? hash[key] !== undefined : hasOwnProperty$3.call(hash, key);
|
1575 | }
|
1576 |
|
1577 | |
1578 |
|
1579 |
|
1580 |
|
1581 |
|
1582 |
|
1583 |
|
1584 |
|
1585 | function hashDelete(hash, key) {
|
1586 | return hashHas(hash, key) && delete hash[key];
|
1587 | }
|
1588 |
|
1589 | |
1590 |
|
1591 |
|
1592 |
|
1593 |
|
1594 |
|
1595 |
|
1596 | function isKeyable(value) {
|
1597 | var type = typeof value;
|
1598 | return type == 'number' || type == 'boolean' ||
|
1599 | (type == 'string' && value != '__proto__') || value == null;
|
1600 | }
|
1601 |
|
1602 | |
1603 |
|
1604 |
|
1605 |
|
1606 |
|
1607 |
|
1608 |
|
1609 |
|
1610 |
|
1611 | function mapDelete(key) {
|
1612 | var data = this.__data__;
|
1613 | if (isKeyable(key)) {
|
1614 | return hashDelete(typeof key == 'string' ? data.string : data.hash, key);
|
1615 | }
|
1616 | return Map ? data.map['delete'](key) : assocDelete(data.map, key);
|
1617 | }
|
1618 |
|
1619 |
|
1620 | var HASH_UNDEFINED = '__lodash_hash_undefined__';
|
1621 |
|
1622 |
|
1623 | var objectProto$8 = Object.prototype;
|
1624 |
|
1625 |
|
1626 | var hasOwnProperty$4 = objectProto$8.hasOwnProperty;
|
1627 |
|
1628 | |
1629 |
|
1630 |
|
1631 |
|
1632 |
|
1633 |
|
1634 |
|
1635 |
|
1636 | function hashGet(hash, key) {
|
1637 | if (nativeCreate) {
|
1638 | var result = hash[key];
|
1639 | return result === HASH_UNDEFINED ? undefined : result;
|
1640 | }
|
1641 | return hasOwnProperty$4.call(hash, key) ? hash[key] : undefined;
|
1642 | }
|
1643 |
|
1644 | |
1645 |
|
1646 |
|
1647 |
|
1648 |
|
1649 |
|
1650 |
|
1651 |
|
1652 |
|
1653 | function mapGet(key) {
|
1654 | var data = this.__data__;
|
1655 | if (isKeyable(key)) {
|
1656 | return hashGet(typeof key == 'string' ? data.string : data.hash, key);
|
1657 | }
|
1658 | return Map ? data.map.get(key) : assocGet(data.map, key);
|
1659 | }
|
1660 |
|
1661 | |
1662 |
|
1663 |
|
1664 |
|
1665 |
|
1666 |
|
1667 |
|
1668 |
|
1669 |
|
1670 | function mapHas(key) {
|
1671 | var data = this.__data__;
|
1672 | if (isKeyable(key)) {
|
1673 | return hashHas(typeof key == 'string' ? data.string : data.hash, key);
|
1674 | }
|
1675 | return Map ? data.map.has(key) : assocHas(data.map, key);
|
1676 | }
|
1677 |
|
1678 | |
1679 |
|
1680 |
|
1681 |
|
1682 |
|
1683 |
|
1684 |
|
1685 |
|
1686 | function assocSet(array, key, value) {
|
1687 | var index = assocIndexOf(array, key);
|
1688 | if (index < 0) {
|
1689 | array.push([key, value]);
|
1690 | } else {
|
1691 | array[index][1] = value;
|
1692 | }
|
1693 | }
|
1694 |
|
1695 |
|
1696 | var HASH_UNDEFINED$1 = '__lodash_hash_undefined__';
|
1697 |
|
1698 | |
1699 |
|
1700 |
|
1701 |
|
1702 |
|
1703 |
|
1704 |
|
1705 |
|
1706 | function hashSet(hash, key, value) {
|
1707 | hash[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED$1 : value;
|
1708 | }
|
1709 |
|
1710 | |
1711 |
|
1712 |
|
1713 |
|
1714 |
|
1715 |
|
1716 |
|
1717 |
|
1718 |
|
1719 |
|
1720 | function mapSet(key, value) {
|
1721 | var data = this.__data__;
|
1722 | if (isKeyable(key)) {
|
1723 | hashSet(typeof key == 'string' ? data.string : data.hash, key, value);
|
1724 | } else if (Map) {
|
1725 | data.map.set(key, value);
|
1726 | } else {
|
1727 | assocSet(data.map, key, value);
|
1728 | }
|
1729 | return this;
|
1730 | }
|
1731 |
|
1732 | |
1733 |
|
1734 |
|
1735 |
|
1736 |
|
1737 |
|
1738 |
|
1739 | function MapCache(values) {
|
1740 | var index = -1,
|
1741 | length = values ? values.length : 0;
|
1742 |
|
1743 | this.clear();
|
1744 | while (++index < length) {
|
1745 | var entry = values[index];
|
1746 | this.set(entry[0], entry[1]);
|
1747 | }
|
1748 | }
|
1749 |
|
1750 |
|
1751 | MapCache.prototype.clear = mapClear;
|
1752 | MapCache.prototype['delete'] = mapDelete;
|
1753 | MapCache.prototype.get = mapGet;
|
1754 | MapCache.prototype.has = mapHas;
|
1755 | MapCache.prototype.set = mapSet;
|
1756 |
|
1757 |
|
1758 | var LARGE_ARRAY_SIZE = 200;
|
1759 |
|
1760 | |
1761 |
|
1762 |
|
1763 |
|
1764 |
|
1765 |
|
1766 |
|
1767 |
|
1768 |
|
1769 |
|
1770 | function stackSet(key, value) {
|
1771 | var data = this.__data__,
|
1772 | array = data.array;
|
1773 |
|
1774 | if (array) {
|
1775 | if (array.length < (LARGE_ARRAY_SIZE - 1)) {
|
1776 | assocSet(array, key, value);
|
1777 | } else {
|
1778 | data.array = null;
|
1779 | data.map = new MapCache(array);
|
1780 | }
|
1781 | }
|
1782 | var map = data.map;
|
1783 | if (map) {
|
1784 | map.set(key, value);
|
1785 | }
|
1786 | return this;
|
1787 | }
|
1788 |
|
1789 | |
1790 |
|
1791 |
|
1792 |
|
1793 |
|
1794 |
|
1795 |
|
1796 | function Stack(values) {
|
1797 | var index = -1,
|
1798 | length = values ? values.length : 0;
|
1799 |
|
1800 | this.clear();
|
1801 | while (++index < length) {
|
1802 | var entry = values[index];
|
1803 | this.set(entry[0], entry[1]);
|
1804 | }
|
1805 | }
|
1806 |
|
1807 |
|
1808 | Stack.prototype.clear = stackClear;
|
1809 | Stack.prototype['delete'] = stackDelete;
|
1810 | Stack.prototype.get = stackGet;
|
1811 | Stack.prototype.has = stackHas;
|
1812 | Stack.prototype.set = stackSet;
|
1813 |
|
1814 |
|
1815 | var objectProto$9 = Object.prototype;
|
1816 |
|
1817 |
|
1818 | var hasOwnProperty$5 = objectProto$9.hasOwnProperty;
|
1819 |
|
1820 | |
1821 |
|
1822 |
|
1823 |
|
1824 |
|
1825 |
|
1826 |
|
1827 |
|
1828 |
|
1829 |
|
1830 | function assignValue(object, key, value) {
|
1831 | var objValue = object[key];
|
1832 | if (!(hasOwnProperty$5.call(object, key) && eq(objValue, value)) ||
|
1833 | (value === undefined && !(key in object))) {
|
1834 | object[key] = value;
|
1835 | }
|
1836 | }
|
1837 |
|
1838 | |
1839 |
|
1840 |
|
1841 |
|
1842 |
|
1843 |
|
1844 |
|
1845 |
|
1846 |
|
1847 |
|
1848 |
|
1849 | function copyObjectWith(source, props, object, customizer) {
|
1850 | object || (object = {});
|
1851 |
|
1852 | var index = -1,
|
1853 | length = props.length;
|
1854 |
|
1855 | while (++index < length) {
|
1856 | var key = props[index];
|
1857 |
|
1858 | var newValue = customizer
|
1859 | ? customizer(object[key], source[key], key, object, source)
|
1860 | : source[key];
|
1861 |
|
1862 | assignValue(object, key, newValue);
|
1863 | }
|
1864 | return object;
|
1865 | }
|
1866 |
|
1867 | |
1868 |
|
1869 |
|
1870 |
|
1871 |
|
1872 |
|
1873 |
|
1874 |
|
1875 |
|
1876 | function copyObject(source, props, object) {
|
1877 | return copyObjectWith(source, props, object);
|
1878 | }
|
1879 |
|
1880 | |
1881 |
|
1882 |
|
1883 |
|
1884 |
|
1885 |
|
1886 |
|
1887 |
|
1888 |
|
1889 | function baseAssign(object, source) {
|
1890 | return object && copyObject(source, keys(source), object);
|
1891 | }
|
1892 |
|
1893 | |
1894 |
|
1895 |
|
1896 |
|
1897 |
|
1898 |
|
1899 |
|
1900 |
|
1901 | function cloneBuffer(buffer, isDeep) {
|
1902 | if (isDeep) {
|
1903 | return buffer.slice();
|
1904 | }
|
1905 | var result = new buffer.constructor(buffer.length);
|
1906 | buffer.copy(result);
|
1907 | return result;
|
1908 | }
|
1909 |
|
1910 | |
1911 |
|
1912 |
|
1913 |
|
1914 |
|
1915 |
|
1916 |
|
1917 |
|
1918 | function copyArray(source, array) {
|
1919 | var index = -1,
|
1920 | length = source.length;
|
1921 |
|
1922 | array || (array = Array(length));
|
1923 | while (++index < length) {
|
1924 | array[index] = source[index];
|
1925 | }
|
1926 | return array;
|
1927 | }
|
1928 |
|
1929 |
|
1930 | var getOwnPropertySymbols = Object.getOwnPropertySymbols;
|
1931 |
|
1932 | |
1933 |
|
1934 |
|
1935 |
|
1936 |
|
1937 |
|
1938 |
|
1939 | var getSymbols = getOwnPropertySymbols || function() {
|
1940 | return [];
|
1941 | };
|
1942 |
|
1943 | |
1944 |
|
1945 |
|
1946 |
|
1947 |
|
1948 |
|
1949 |
|
1950 |
|
1951 | function copySymbols(source, object) {
|
1952 | return copyObject(source, getSymbols(source), object);
|
1953 | }
|
1954 |
|
1955 |
|
1956 | var Set = getNative(root, 'Set');
|
1957 |
|
1958 |
|
1959 | var WeakMap = getNative(root, 'WeakMap');
|
1960 |
|
1961 | var mapTag$1 = '[object Map]';
|
1962 | var objectTag$1 = '[object Object]';
|
1963 | var setTag$1 = '[object Set]';
|
1964 | var weakMapTag$1 = '[object WeakMap]';
|
1965 |
|
1966 | var objectProto$10 = Object.prototype;
|
1967 |
|
1968 |
|
1969 | var funcToString$1 = Function.prototype.toString;
|
1970 |
|
1971 | |
1972 |
|
1973 |
|
1974 |
|
1975 | var objectToString$3 = objectProto$10.toString;
|
1976 |
|
1977 |
|
1978 | var mapCtorString = Map ? funcToString$1.call(Map) : '';
|
1979 | var setCtorString = Set ? funcToString$1.call(Set) : '';
|
1980 | var weakMapCtorString = WeakMap ? funcToString$1.call(WeakMap) : '';
|
1981 | |
1982 |
|
1983 |
|
1984 |
|
1985 |
|
1986 |
|
1987 |
|
1988 | function getTag(value) {
|
1989 | return objectToString$3.call(value);
|
1990 | }
|
1991 |
|
1992 |
|
1993 | if ((Map && getTag(new Map) != mapTag$1) ||
|
1994 | (Set && getTag(new Set) != setTag$1) ||
|
1995 | (WeakMap && getTag(new WeakMap) != weakMapTag$1)) {
|
1996 | getTag = function(value) {
|
1997 | var result = objectToString$3.call(value),
|
1998 | Ctor = result == objectTag$1 ? value.constructor : null,
|
1999 | ctorString = typeof Ctor == 'function' ? funcToString$1.call(Ctor) : '';
|
2000 |
|
2001 | if (ctorString) {
|
2002 | switch (ctorString) {
|
2003 | case mapCtorString: return mapTag$1;
|
2004 | case setCtorString: return setTag$1;
|
2005 | case weakMapCtorString: return weakMapTag$1;
|
2006 | }
|
2007 | }
|
2008 | return result;
|
2009 | };
|
2010 | }
|
2011 |
|
2012 | var getTag$1 = getTag;
|
2013 |
|
2014 |
|
2015 | var objectProto$11 = Object.prototype;
|
2016 |
|
2017 |
|
2018 | var hasOwnProperty$6 = objectProto$11.hasOwnProperty;
|
2019 |
|
2020 | |
2021 |
|
2022 |
|
2023 |
|
2024 |
|
2025 |
|
2026 |
|
2027 | function initCloneArray(array) {
|
2028 | var length = array.length,
|
2029 | result = array.constructor(length);
|
2030 |
|
2031 |
|
2032 | if (length && typeof array[0] == 'string' && hasOwnProperty$6.call(array, 'index')) {
|
2033 | result.index = array.index;
|
2034 | result.input = array.input;
|
2035 | }
|
2036 | return result;
|
2037 | }
|
2038 |
|
2039 |
|
2040 | var Uint8Array = root.Uint8Array;
|
2041 |
|
2042 | |
2043 |
|
2044 |
|
2045 |
|
2046 |
|
2047 |
|
2048 |
|
2049 | function cloneArrayBuffer(arrayBuffer) {
|
2050 | var result = new arrayBuffer.constructor(arrayBuffer.byteLength);
|
2051 | new Uint8Array(result).set(new Uint8Array(arrayBuffer));
|
2052 | return result;
|
2053 | }
|
2054 |
|
2055 | |
2056 |
|
2057 |
|
2058 |
|
2059 |
|
2060 |
|
2061 |
|
2062 |
|
2063 | function addMapEntry(map, pair) {
|
2064 |
|
2065 | map.set(pair[0], pair[1]);
|
2066 | return map;
|
2067 | }
|
2068 |
|
2069 | |
2070 |
|
2071 |
|
2072 |
|
2073 |
|
2074 |
|
2075 |
|
2076 |
|
2077 |
|
2078 |
|
2079 |
|
2080 | function arrayReduce(array, iteratee, accumulator, initAccum) {
|
2081 | var index = -1,
|
2082 | length = array.length;
|
2083 |
|
2084 | if (initAccum && length) {
|
2085 | accumulator = array[++index];
|
2086 | }
|
2087 | while (++index < length) {
|
2088 | accumulator = iteratee(accumulator, array[index], index, array);
|
2089 | }
|
2090 | return accumulator;
|
2091 | }
|
2092 |
|
2093 | |
2094 |
|
2095 |
|
2096 |
|
2097 |
|
2098 |
|
2099 |
|
2100 | function mapToArray(map) {
|
2101 | var index = -1,
|
2102 | result = Array(map.size);
|
2103 |
|
2104 | map.forEach(function(value, key) {
|
2105 | result[++index] = [key, value];
|
2106 | });
|
2107 | return result;
|
2108 | }
|
2109 |
|
2110 | |
2111 |
|
2112 |
|
2113 |
|
2114 |
|
2115 |
|
2116 |
|
2117 | function cloneMap(map) {
|
2118 | return arrayReduce(mapToArray(map), addMapEntry, new map.constructor);
|
2119 | }
|
2120 |
|
2121 |
|
2122 | var reFlags = /\w*$/;
|
2123 |
|
2124 | |
2125 |
|
2126 |
|
2127 |
|
2128 |
|
2129 |
|
2130 |
|
2131 | function cloneRegExp(regexp) {
|
2132 | var result = new regexp.constructor(regexp.source, reFlags.exec(regexp));
|
2133 | result.lastIndex = regexp.lastIndex;
|
2134 | return result;
|
2135 | }
|
2136 |
|
2137 | |
2138 |
|
2139 |
|
2140 |
|
2141 |
|
2142 |
|
2143 |
|
2144 |
|
2145 | function addSetEntry(set, value) {
|
2146 | set.add(value);
|
2147 | return set;
|
2148 | }
|
2149 |
|
2150 | /**
|
2151 | * Converts `set` to an array.
|
2152 | *
|
2153 | * @private
|
2154 | * @param {Object} set The set to convert.
|
2155 | * @returns {Array} Returns the converted array.
|
2156 | */
|
2157 | function setToArray(set) {
|
2158 | var index = -1,
|
2159 | result = Array(set.size);
|
2160 |
|
2161 | set.forEach(function(value) {
|
2162 | result[++index] = value;
|
2163 | });
|
2164 | return result;
|
2165 | }
|
2166 |
|
2167 | |
2168 |
|
2169 |
|
2170 |
|
2171 |
|
2172 |
|
2173 |
|
2174 | function cloneSet(set) {
|
2175 | return arrayReduce(setToArray(set), addSetEntry, new set.constructor);
|
2176 | }
|
2177 |
|
2178 | /** Built-in value references. */
|
2179 | var Symbol$1 = root.Symbol;
|
2180 |
|
2181 | var symbolProto = Symbol$1 ? Symbol$1.prototype : undefined;
|
2182 | var symbolValueOf = symbolProto ? symbolProto.valueOf : undefined;
|
2183 | /**
|
2184 | * Creates a clone of the `symbol` object.
|
2185 | *
|
2186 | * @private
|
2187 | * @param {Object} symbol The symbol object to clone.
|
2188 | * @returns {Object} Returns the cloned symbol object.
|
2189 | */
|
2190 | function cloneSymbol(symbol) {
|
2191 | return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {};
|
2192 | }
|
2193 |
|
2194 | |
2195 |
|
2196 |
|
2197 |
|
2198 |
|
2199 |
|
2200 |
|
2201 |
|
2202 | function cloneTypedArray(typedArray, isDeep) {
|
2203 | var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer;
|
2204 | return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length);
|
2205 | }
|
2206 |
|
2207 | var boolTag$1 = '[object Boolean]';
|
2208 | var dateTag$1 = '[object Date]';
|
2209 | var mapTag$2 = '[object Map]';
|
2210 | var numberTag$1 = '[object Number]';
|
2211 | var regexpTag$1 = '[object RegExp]';
|
2212 | var setTag$2 = '[object Set]';
|
2213 | var stringTag$2 = '[object String]';
|
2214 | var symbolTag$1 = '[object Symbol]';
|
2215 | var arrayBufferTag$1 = '[object ArrayBuffer]';
|
2216 | var float32Tag$1 = '[object Float32Array]';
|
2217 | var float64Tag$1 = '[object Float64Array]';
|
2218 | var int8Tag$1 = '[object Int8Array]';
|
2219 | var int16Tag$1 = '[object Int16Array]';
|
2220 | var int32Tag$1 = '[object Int32Array]';
|
2221 | var uint8Tag$1 = '[object Uint8Array]';
|
2222 | var uint8ClampedTag$1 = '[object Uint8ClampedArray]';
|
2223 | var uint16Tag$1 = '[object Uint16Array]';
|
2224 | var uint32Tag$1 = '[object Uint32Array]';
|
2225 | |
2226 |
|
2227 |
|
2228 |
|
2229 |
|
2230 |
|
2231 |
|
2232 |
|
2233 |
|
2234 |
|
2235 |
|
2236 |
|
2237 | function initCloneByTag(object, tag, isDeep) {
|
2238 | var Ctor = object.constructor;
|
2239 | switch (tag) {
|
2240 | case arrayBufferTag$1:
|
2241 | return cloneArrayBuffer(object);
|
2242 |
|
2243 | case boolTag$1:
|
2244 | case dateTag$1:
|
2245 | return new Ctor(+object);
|
2246 |
|
2247 | case float32Tag$1: case float64Tag$1:
|
2248 | case int8Tag$1: case int16Tag$1: case int32Tag$1:
|
2249 | case uint8Tag$1: case uint8ClampedTag$1: case uint16Tag$1: case uint32Tag$1:
|
2250 | return cloneTypedArray(object, isDeep);
|
2251 |
|
2252 | case mapTag$2:
|
2253 | return cloneMap(object);
|
2254 |
|
2255 | case numberTag$1:
|
2256 | case stringTag$2:
|
2257 | return new Ctor(object);
|
2258 |
|
2259 | case regexpTag$1:
|
2260 | return cloneRegExp(object);
|
2261 |
|
2262 | case setTag$2:
|
2263 | return cloneSet(object);
|
2264 |
|
2265 | case symbolTag$1:
|
2266 | return cloneSymbol(object);
|
2267 | }
|
2268 | }
|
2269 |
|
2270 |
|
2271 | var objectCreate = Object.create;
|
2272 |
|
2273 | |
2274 |
|
2275 |
|
2276 |
|
2277 |
|
2278 |
|
2279 |
|
2280 |
|
2281 | function baseCreate(proto) {
|
2282 | return isObject(proto) ? objectCreate(proto) : {};
|
2283 | }
|
2284 |
|
2285 |
|
2286 | var getPrototypeOf$1 = Object.getPrototypeOf;
|
2287 |
|
2288 | |
2289 |
|
2290 |
|
2291 |
|
2292 |
|
2293 |
|
2294 |
|
2295 | function initCloneObject(object) {
|
2296 | return (typeof object.constructor == 'function' && !isPrototype(object))
|
2297 | ? baseCreate(getPrototypeOf$1(object))
|
2298 | : {};
|
2299 | }
|
2300 |
|
2301 | |
2302 |
|
2303 |
|
2304 |
|
2305 |
|
2306 |
|
2307 |
|
2308 |
|
2309 |
|
2310 |
|
2311 |
|
2312 |
|
2313 |
|
2314 |
|
2315 |
|
2316 |
|
2317 | function constant(value) {
|
2318 | return function() {
|
2319 | return value;
|
2320 | };
|
2321 | }
|
2322 |
|
2323 |
|
2324 | var objectTypes$1 = {
|
2325 | 'function': true,
|
2326 | 'object': true
|
2327 | };
|
2328 |
|
2329 |
|
2330 | var freeExports$1 = (objectTypes$1[typeof exports] && exports && !exports.nodeType)
|
2331 | ? exports
|
2332 | : undefined;
|
2333 |
|
2334 |
|
2335 | var freeModule$1 = (objectTypes$1[typeof module] && module && !module.nodeType)
|
2336 | ? module
|
2337 | : undefined;
|
2338 |
|
2339 |
|
2340 | var moduleExports = (freeModule$1 && freeModule$1.exports === freeExports$1)
|
2341 | ? freeExports$1
|
2342 | : undefined;
|
2343 |
|
2344 |
|
2345 | var Buffer = moduleExports ? root.Buffer : undefined;
|
2346 |
|
2347 | |
2348 |
|
2349 |
|
2350 |
|
2351 |
|
2352 |
|
2353 |
|
2354 |
|
2355 |
|
2356 |
|
2357 |
|
2358 |
|
2359 |
|
2360 |
|
2361 |
|
2362 |
|
2363 | var isBuffer = !Buffer ? constant(false) : function(value) {
|
2364 | return value instanceof Buffer;
|
2365 | };
|
2366 |
|
2367 | var argsTag$1 = '[object Arguments]';
|
2368 | var arrayTag = '[object Array]';
|
2369 | var boolTag = '[object Boolean]';
|
2370 | var dateTag = '[object Date]';
|
2371 | var errorTag = '[object Error]';
|
2372 | var funcTag$1 = '[object Function]';
|
2373 | var genTag$1 = '[object GeneratorFunction]';
|
2374 | var mapTag = '[object Map]';
|
2375 | var numberTag = '[object Number]';
|
2376 | var objectTag = '[object Object]';
|
2377 | var regexpTag = '[object RegExp]';
|
2378 | var setTag = '[object Set]';
|
2379 | var stringTag$1 = '[object String]';
|
2380 | var symbolTag = '[object Symbol]';
|
2381 | var weakMapTag = '[object WeakMap]';
|
2382 | var arrayBufferTag = '[object ArrayBuffer]';
|
2383 | var float32Tag = '[object Float32Array]';
|
2384 | var float64Tag = '[object Float64Array]';
|
2385 | var int8Tag = '[object Int8Array]';
|
2386 | var int16Tag = '[object Int16Array]';
|
2387 | var int32Tag = '[object Int32Array]';
|
2388 | var uint8Tag = '[object Uint8Array]';
|
2389 | var uint8ClampedTag = '[object Uint8ClampedArray]';
|
2390 | var uint16Tag = '[object Uint16Array]';
|
2391 | var uint32Tag = '[object Uint32Array]';
|
2392 |
|
2393 | var cloneableTags = {};
|
2394 | cloneableTags[argsTag$1] = cloneableTags[arrayTag] =
|
2395 | cloneableTags[arrayBufferTag] = cloneableTags[boolTag] =
|
2396 | cloneableTags[dateTag] = cloneableTags[float32Tag] =
|
2397 | cloneableTags[float64Tag] = cloneableTags[int8Tag] =
|
2398 | cloneableTags[int16Tag] = cloneableTags[int32Tag] =
|
2399 | cloneableTags[mapTag] = cloneableTags[numberTag] =
|
2400 | cloneableTags[objectTag] = cloneableTags[regexpTag] =
|
2401 | cloneableTags[setTag] = cloneableTags[stringTag$1] =
|
2402 | cloneableTags[symbolTag] = cloneableTags[uint8Tag] =
|
2403 | cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] =
|
2404 | cloneableTags[uint32Tag] = true;
|
2405 | cloneableTags[errorTag] = cloneableTags[funcTag$1] =
|
2406 | cloneableTags[weakMapTag] = false;
|
2407 |
|
2408 | |
2409 |
|
2410 |
|
2411 |
|
2412 |
|
2413 |
|
2414 |
|
2415 |
|
2416 |
|
2417 |
|
2418 |
|
2419 |
|
2420 |
|
2421 |
|
2422 | function baseClone(value, isDeep, isFull, customizer, key, object, stack) {
|
2423 | var result;
|
2424 | if (customizer) {
|
2425 | result = object ? customizer(value, key, object, stack) : customizer(value);
|
2426 | }
|
2427 | if (result !== undefined) {
|
2428 | return result;
|
2429 | }
|
2430 | if (!isObject(value)) {
|
2431 | return value;
|
2432 | }
|
2433 | var isArr = isArray(value);
|
2434 | if (isArr) {
|
2435 | result = initCloneArray(value);
|
2436 | if (!isDeep) {
|
2437 | return copyArray(value, result);
|
2438 | }
|
2439 | } else {
|
2440 | var tag = getTag$1(value),
|
2441 | isFunc = tag == funcTag$1 || tag == genTag$1;
|
2442 |
|
2443 | if (isBuffer(value)) {
|
2444 | return cloneBuffer(value, isDeep);
|
2445 | }
|
2446 | if (tag == objectTag || tag == argsTag$1 || (isFunc && !object)) {
|
2447 | if (isHostObject(value)) {
|
2448 | return object ? value : {};
|
2449 | }
|
2450 | result = initCloneObject(isFunc ? {} : value);
|
2451 | if (!isDeep) {
|
2452 | result = baseAssign(result, value);
|
2453 | return isFull ? copySymbols(value, result) : result;
|
2454 | }
|
2455 | } else {
|
2456 | if (!cloneableTags[tag]) {
|
2457 | return object ? value : {};
|
2458 | }
|
2459 | result = initCloneByTag(value, tag, isDeep);
|
2460 | }
|
2461 | }
|
2462 |
|
2463 | stack || (stack = new Stack);
|
2464 | var stacked = stack.get(value);
|
2465 | if (stacked) {
|
2466 | return stacked;
|
2467 | }
|
2468 | stack.set(value, result);
|
2469 |
|
2470 |
|
2471 | (isArr ? arrayEach : baseForOwn)(value, function(subValue, key) {
|
2472 | assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack));
|
2473 | });
|
2474 | return (isFull && !isArr) ? copySymbols(value, result) : result;
|
2475 | }
|
2476 |
|
2477 | var argsRegex = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
|
2478 |
|
2479 | function parseParams(func) {
|
2480 | return func.toString().match(argsRegex)[1].split(/\s*\,\s*/);
|
2481 | }
|
2482 |
|
2483 | function autoInject(tasks, callback) {
|
2484 | var newTasks = {};
|
2485 |
|
2486 | forOwn(tasks, function (taskFn, key) {
|
2487 | var params;
|
2488 |
|
2489 | if (isArray(taskFn)) {
|
2490 | params = baseClone(taskFn);
|
2491 | taskFn = params.pop();
|
2492 |
|
2493 | newTasks[key] = params.concat(newTask);
|
2494 | } else if (taskFn.length === 0) {
|
2495 | throw new Error("autoInject task functions require explicit parameters.");
|
2496 | } else if (taskFn.length === 1) {
|
2497 |
|
2498 | newTasks[key] = taskFn;
|
2499 | } else {
|
2500 | params = parseParams(taskFn);
|
2501 | params.pop();
|
2502 |
|
2503 | newTasks[key] = params.concat(newTask);
|
2504 | }
|
2505 |
|
2506 | function newTask(results, taskCb) {
|
2507 | var newArgs = arrayMap(params, function (name) {
|
2508 | return results[name];
|
2509 | });
|
2510 | newArgs.push(taskCb);
|
2511 | taskFn.apply(null, newArgs);
|
2512 | }
|
2513 | });
|
2514 |
|
2515 | auto(newTasks, callback);
|
2516 | }
|
2517 |
|
2518 | var _setImmediate = typeof setImmediate === 'function' && setImmediate;
|
2519 |
|
2520 | var _defer;
|
2521 | if (_setImmediate) {
|
2522 | _defer = _setImmediate;
|
2523 | } else if (typeof process === 'object' && typeof process.nextTick === 'function') {
|
2524 | _defer = process.nextTick;
|
2525 | } else {
|
2526 | _defer = function (fn) {
|
2527 | setTimeout(fn, 0);
|
2528 | };
|
2529 | }
|
2530 |
|
2531 | var setImmediate$1 = rest(function (fn, args) {
|
2532 | _defer(function () {
|
2533 | fn.apply(null, args);
|
2534 | });
|
2535 | });
|
2536 |
|
2537 | function queue(worker, concurrency, payload) {
|
2538 | if (concurrency == null) {
|
2539 | concurrency = 1;
|
2540 | } else if (concurrency === 0) {
|
2541 | throw new Error('Concurrency must not be zero');
|
2542 | }
|
2543 | function _insert(q, data, pos, callback) {
|
2544 | if (callback != null && typeof callback !== 'function') {
|
2545 | throw new Error('task callback must be a function');
|
2546 | }
|
2547 | q.started = true;
|
2548 | if (!isArray(data)) {
|
2549 | data = [data];
|
2550 | }
|
2551 | if (data.length === 0 && q.idle()) {
|
2552 |
|
2553 | return setImmediate$1(function () {
|
2554 | q.drain();
|
2555 | });
|
2556 | }
|
2557 | arrayEach(data, function (task) {
|
2558 | var item = {
|
2559 | data: task,
|
2560 | callback: callback || noop
|
2561 | };
|
2562 |
|
2563 | if (pos) {
|
2564 | q.tasks.unshift(item);
|
2565 | } else {
|
2566 | q.tasks.push(item);
|
2567 | }
|
2568 | });
|
2569 | setImmediate$1(q.process);
|
2570 | }
|
2571 | function _next(q, tasks) {
|
2572 | return function () {
|
2573 | workers -= 1;
|
2574 |
|
2575 | var removed = false;
|
2576 | var args = arguments;
|
2577 | arrayEach(tasks, function (task) {
|
2578 | arrayEach(workersList, function (worker, index) {
|
2579 | if (worker === task && !removed) {
|
2580 | workersList.splice(index, 1);
|
2581 | removed = true;
|
2582 | }
|
2583 | });
|
2584 |
|
2585 | task.callback.apply(task, args);
|
2586 | });
|
2587 |
|
2588 | if (workers <= q.concurrency - q.buffer) {
|
2589 | q.unsaturated();
|
2590 | }
|
2591 |
|
2592 | if (q.tasks.length + workers === 0) {
|
2593 | q.drain();
|
2594 | }
|
2595 | q.process();
|
2596 | };
|
2597 | }
|
2598 |
|
2599 | var workers = 0;
|
2600 | var workersList = [];
|
2601 | var q = {
|
2602 | tasks: [],
|
2603 | concurrency: concurrency,
|
2604 | payload: payload,
|
2605 | saturated: noop,
|
2606 | unsaturated: noop,
|
2607 | buffer: concurrency / 4,
|
2608 | empty: noop,
|
2609 | drain: noop,
|
2610 | started: false,
|
2611 | paused: false,
|
2612 | push: function (data, callback) {
|
2613 | _insert(q, data, false, callback);
|
2614 | },
|
2615 | kill: function () {
|
2616 | q.drain = noop;
|
2617 | q.tasks = [];
|
2618 | },
|
2619 | unshift: function (data, callback) {
|
2620 | _insert(q, data, true, callback);
|
2621 | },
|
2622 | process: function () {
|
2623 | while (!q.paused && workers < q.concurrency && q.tasks.length) {
|
2624 |
|
2625 | var tasks = q.payload ? q.tasks.splice(0, q.payload) : q.tasks.splice(0, q.tasks.length);
|
2626 |
|
2627 | var data = arrayMap(tasks, baseProperty('data'));
|
2628 |
|
2629 | if (q.tasks.length === 0) {
|
2630 | q.empty();
|
2631 | }
|
2632 | workers += 1;
|
2633 | workersList.push(tasks[0]);
|
2634 |
|
2635 | if (workers === q.concurrency) {
|
2636 | q.saturated();
|
2637 | }
|
2638 |
|
2639 | var cb = onlyOnce(_next(q, tasks));
|
2640 | worker(data, cb);
|
2641 | }
|
2642 | },
|
2643 | length: function () {
|
2644 | return q.tasks.length;
|
2645 | },
|
2646 | running: function () {
|
2647 | return workers;
|
2648 | },
|
2649 | workersList: function () {
|
2650 | return workersList;
|
2651 | },
|
2652 | idle: function () {
|
2653 | return q.tasks.length + workers === 0;
|
2654 | },
|
2655 | pause: function () {
|
2656 | q.paused = true;
|
2657 | },
|
2658 | resume: function () {
|
2659 | if (q.paused === false) {
|
2660 | return;
|
2661 | }
|
2662 | q.paused = false;
|
2663 | var resumeCount = Math.min(q.concurrency, q.tasks.length);
|
2664 |
|
2665 |
|
2666 | for (var w = 1; w <= resumeCount; w++) {
|
2667 | setImmediate$1(q.process);
|
2668 | }
|
2669 | }
|
2670 | };
|
2671 | return q;
|
2672 | }
|
2673 |
|
2674 | function cargo(worker, payload) {
|
2675 | return queue(worker, 1, payload);
|
2676 | }
|
2677 |
|
2678 | function reduce(arr, memo, iteratee, cb) {
|
2679 | eachOfSeries(arr, function (x, i, cb) {
|
2680 | iteratee(memo, x, function (err, v) {
|
2681 | memo = v;
|
2682 | cb(err);
|
2683 | });
|
2684 | }, function (err) {
|
2685 | cb(err, memo);
|
2686 | });
|
2687 | }
|
2688 |
|
2689 | function seq() /* functions... */{
|
2690 | var fns = arguments;
|
2691 | return rest(function (args) {
|
2692 | var that = this;
|
2693 |
|
2694 | var cb = args[args.length - 1];
|
2695 | if (typeof cb == 'function') {
|
2696 | args.pop();
|
2697 | } else {
|
2698 | cb = noop;
|
2699 | }
|
2700 |
|
2701 | reduce(fns, args, function (newargs, fn, cb) {
|
2702 | fn.apply(that, newargs.concat([rest(function (err, nextargs) {
|
2703 | cb(err, nextargs);
|
2704 | })]));
|
2705 | }, function (err, results) {
|
2706 | cb.apply(that, [err].concat(results));
|
2707 | });
|
2708 | });
|
2709 | }
|
2710 |
|
2711 | var reverse = Array.prototype.reverse;
|
2712 |
|
2713 | function compose() /* functions... */{
|
2714 | return seq.apply(null, reverse.call(arguments));
|
2715 | }
|
2716 |
|
2717 | function concat$1(eachfn, arr, fn, callback) {
|
2718 | var result = [];
|
2719 | eachfn(arr, function (x, index, cb) {
|
2720 | fn(x, function (err, y) {
|
2721 | result = result.concat(y || []);
|
2722 | cb(err);
|
2723 | });
|
2724 | }, function (err) {
|
2725 | callback(err, result);
|
2726 | });
|
2727 | }
|
2728 |
|
2729 | function doParallel(fn) {
|
2730 | return function (obj, iteratee, callback) {
|
2731 | return fn(eachOf, obj, iteratee, callback);
|
2732 | };
|
2733 | }
|
2734 |
|
2735 | var concat = doParallel(concat$1);
|
2736 |
|
2737 | function doSeries(fn) {
|
2738 | return function (obj, iteratee, callback) {
|
2739 | return fn(eachOfSeries, obj, iteratee, callback);
|
2740 | };
|
2741 | }
|
2742 |
|
2743 | var concatSeries = doSeries(concat$1);
|
2744 |
|
2745 | var constant$1 = rest(function (values) {
|
2746 | var args = [null].concat(values);
|
2747 | return initialParams(function (ignoredArgs, callback) {
|
2748 | return callback.apply(this, args);
|
2749 | });
|
2750 | });
|
2751 |
|
2752 | function _createTester(eachfn, check, getResult) {
|
2753 | return function (arr, limit, iteratee, cb) {
|
2754 | function done(err) {
|
2755 | if (cb) {
|
2756 | if (err) {
|
2757 | cb(err);
|
2758 | } else {
|
2759 | cb(null, getResult(false));
|
2760 | }
|
2761 | }
|
2762 | }
|
2763 | function wrappedIteratee(x, _, callback) {
|
2764 | if (!cb) return callback();
|
2765 | iteratee(x, function (err, v) {
|
2766 | if (cb) {
|
2767 | if (err) {
|
2768 | cb(err);
|
2769 | cb = iteratee = false;
|
2770 | } else if (check(v)) {
|
2771 | cb(null, getResult(true, x));
|
2772 | cb = iteratee = false;
|
2773 | }
|
2774 | }
|
2775 | callback();
|
2776 | });
|
2777 | }
|
2778 | if (arguments.length > 3) {
|
2779 | eachfn(arr, limit, wrappedIteratee, done);
|
2780 | } else {
|
2781 | cb = iteratee;
|
2782 | iteratee = limit;
|
2783 | eachfn(arr, wrappedIteratee, done);
|
2784 | }
|
2785 | };
|
2786 | }
|
2787 |
|
2788 | function _findGetResult(v, x) {
|
2789 | return x;
|
2790 | }
|
2791 |
|
2792 | var detect = _createTester(eachOf, identity, _findGetResult);
|
2793 |
|
2794 | var detectLimit = _createTester(eachOfLimit, identity, _findGetResult);
|
2795 |
|
2796 | var detectSeries = _createTester(eachOfSeries, identity, _findGetResult);
|
2797 |
|
2798 | function consoleFunc(name) {
|
2799 | return rest(function (fn, args) {
|
2800 | fn.apply(null, args.concat([rest(function (err, args) {
|
2801 | if (typeof console === 'object') {
|
2802 | if (err) {
|
2803 | if (console.error) {
|
2804 | console.error(err);
|
2805 | }
|
2806 | } else if (console[name]) {
|
2807 | arrayEach(args, function (x) {
|
2808 | console[name](x);
|
2809 | });
|
2810 | }
|
2811 | }
|
2812 | })]));
|
2813 | });
|
2814 | }
|
2815 |
|
2816 | var dir = consoleFunc('dir');
|
2817 |
|
2818 | function during(test, iteratee, cb) {
|
2819 | cb = cb || noop;
|
2820 |
|
2821 | var next = rest(function (err, args) {
|
2822 | if (err) {
|
2823 | cb(err);
|
2824 | } else {
|
2825 | args.push(check);
|
2826 | test.apply(this, args);
|
2827 | }
|
2828 | });
|
2829 |
|
2830 | var check = function (err, truth) {
|
2831 | if (err) return cb(err);
|
2832 | if (!truth) return cb(null);
|
2833 | iteratee(next);
|
2834 | };
|
2835 |
|
2836 | test(check);
|
2837 | }
|
2838 |
|
2839 | function doDuring(iteratee, test, cb) {
|
2840 | var calls = 0;
|
2841 |
|
2842 | during(function (next) {
|
2843 | if (calls++ < 1) return next(null, true);
|
2844 | test.apply(this, arguments);
|
2845 | }, iteratee, cb);
|
2846 | }
|
2847 |
|
2848 | function whilst(test, iteratee, cb) {
|
2849 | cb = cb || noop;
|
2850 | if (!test()) return cb(null);
|
2851 | var next = rest(function (err, args) {
|
2852 | if (err) return cb(err);
|
2853 | if (test.apply(this, args)) return iteratee(next);
|
2854 | cb.apply(null, [null].concat(args));
|
2855 | });
|
2856 | iteratee(next);
|
2857 | }
|
2858 |
|
2859 | function doWhilst(iteratee, test, cb) {
|
2860 | var calls = 0;
|
2861 | return whilst(function () {
|
2862 | return ++calls <= 1 || test.apply(this, arguments);
|
2863 | }, iteratee, cb);
|
2864 | }
|
2865 |
|
2866 | function doUntil(iteratee, test, cb) {
|
2867 | return doWhilst(iteratee, function () {
|
2868 | return !test.apply(this, arguments);
|
2869 | }, cb);
|
2870 | }
|
2871 |
|
2872 | function _withoutIndex(iteratee) {
|
2873 | return function (value, index, callback) {
|
2874 | return iteratee(value, callback);
|
2875 | };
|
2876 | }
|
2877 |
|
2878 | function eachLimit(arr, limit, iteratee, cb) {
|
2879 | return _eachOfLimit(limit)(arr, _withoutIndex(iteratee), cb);
|
2880 | }
|
2881 |
|
2882 | var each = doLimit(eachLimit, Infinity);
|
2883 |
|
2884 | var eachSeries = doLimit(eachLimit, 1);
|
2885 |
|
2886 | function ensureAsync(fn) {
|
2887 | return initialParams(function (args, callback) {
|
2888 | var sync = true;
|
2889 | args.push(function () {
|
2890 | var innerArgs = arguments;
|
2891 | if (sync) {
|
2892 | setImmediate$1(function () {
|
2893 | callback.apply(null, innerArgs);
|
2894 | });
|
2895 | } else {
|
2896 | callback.apply(null, innerArgs);
|
2897 | }
|
2898 | });
|
2899 | fn.apply(this, args);
|
2900 | sync = false;
|
2901 | });
|
2902 | }
|
2903 |
|
2904 | function notId(v) {
|
2905 | return !v;
|
2906 | }
|
2907 |
|
2908 | var everyLimit = _createTester(eachOfLimit, notId, notId);
|
2909 |
|
2910 | var every = doLimit(everyLimit, Infinity);
|
2911 |
|
2912 | var everySeries = doLimit(everyLimit, 1);
|
2913 |
|
2914 | function _filter(eachfn, arr, iteratee, callback) {
|
2915 | var results = [];
|
2916 | eachfn(arr, function (x, index, callback) {
|
2917 | iteratee(x, function (err, v) {
|
2918 | if (err) {
|
2919 | callback(err);
|
2920 | } else {
|
2921 | if (v) {
|
2922 | results.push({ index: index, value: x });
|
2923 | }
|
2924 | callback();
|
2925 | }
|
2926 | });
|
2927 | }, function (err) {
|
2928 | if (err) {
|
2929 | callback(err);
|
2930 | } else {
|
2931 | callback(null, arrayMap(results.sort(function (a, b) {
|
2932 | return a.index - b.index;
|
2933 | }), baseProperty('value')));
|
2934 | }
|
2935 | });
|
2936 | }
|
2937 |
|
2938 | function doParallelLimit(fn) {
|
2939 | return function (obj, limit, iteratee, callback) {
|
2940 | return fn(_eachOfLimit(limit), obj, iteratee, callback);
|
2941 | };
|
2942 | }
|
2943 |
|
2944 | var filterLimit = doParallelLimit(_filter);
|
2945 |
|
2946 | var filter = doLimit(filterLimit, Infinity);
|
2947 |
|
2948 | var filterSeries = doLimit(filterLimit, 1);
|
2949 |
|
2950 | function forever(fn, cb) {
|
2951 | var done = onlyOnce(cb || noop);
|
2952 | var task = ensureAsync(fn);
|
2953 |
|
2954 | function next(err) {
|
2955 | if (err) return done(err);
|
2956 | task(next);
|
2957 | }
|
2958 | next();
|
2959 | }
|
2960 |
|
2961 | function iterator$1 (tasks) {
|
2962 | function makeCallback(index) {
|
2963 | function fn() {
|
2964 | if (tasks.length) {
|
2965 | tasks[index].apply(null, arguments);
|
2966 | }
|
2967 | return fn.next();
|
2968 | }
|
2969 | fn.next = function () {
|
2970 | return index < tasks.length - 1 ? makeCallback(index + 1) : null;
|
2971 | };
|
2972 | return fn;
|
2973 | }
|
2974 | return makeCallback(0);
|
2975 | }
|
2976 |
|
2977 | var log = consoleFunc('log');
|
2978 |
|
2979 | function _asyncMap(eachfn, arr, iteratee, callback) {
|
2980 | callback = once(callback || noop);
|
2981 | arr = arr || [];
|
2982 | var results = isArrayLike(arr) || getIterator(arr) ? [] : {};
|
2983 | eachfn(arr, function (value, index, callback) {
|
2984 | iteratee(value, function (err, v) {
|
2985 | results[index] = v;
|
2986 | callback(err);
|
2987 | });
|
2988 | }, function (err) {
|
2989 | callback(err, results);
|
2990 | });
|
2991 | }
|
2992 |
|
2993 | var mapLimit = doParallelLimit(_asyncMap);
|
2994 |
|
2995 | var map = doLimit(mapLimit, Infinity);
|
2996 |
|
2997 | var mapSeries = doLimit(mapLimit, 1);
|
2998 |
|
2999 | /** `Object#toString` result references. */
|
3000 | var symbolTag$2 = '[object Symbol]';
|
3001 |
|
3002 | /** Used for built-in method references. */
|
3003 | var objectProto$12 = Object.prototype;
|
3004 |
|
3005 | /**
|
3006 | * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
|
3007 | * of values.
|
3008 | */
|
3009 | var objectToString$4 = objectProto$12.toString;
|
3010 |
|
3011 | /**
|
3012 | * Checks if `value` is classified as a `Symbol` primitive or object.
|
3013 | *
|
3014 | * @static
|
3015 | * @memberOf _
|
3016 | * @category Lang
|
3017 | * @param {*} value The value to check.
|
3018 | * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
|
3019 | * @example
|
3020 | *
|
3021 | * _.isSymbol(Symbol.iterator);
|
3022 | * // => true
|
3023 | *
|
3024 | * _.isSymbol('abc');
|
3025 | * // => false
|
3026 | */
|
3027 | function isSymbol(value) {
|
3028 | return typeof value == 'symbol' ||
|
3029 | (isObjectLike(value) && objectToString$4.call(value) == symbolTag$2);
|
3030 | }
|
3031 |
|
3032 | /** Used as references for various `Number` constants. */
|
3033 | var INFINITY$1 = 1 / 0;
|
3034 |
|
3035 | /** Used to convert symbols to primitives and strings. */
|
3036 | var symbolProto$1 = Symbol$1 ? Symbol$1.prototype : undefined;
|
3037 | var symbolToString = symbolProto$1 ? symbolProto$1.toString : undefined;
|
3038 | /**
|
3039 | * Converts `value` to a string if it's not one. An empty string is returned
|
3040 | * for `null` and `undefined` values. The sign of `-0` is preserved.
|
3041 | *
|
3042 | * @static
|
3043 | * @memberOf _
|
3044 | * @category Lang
|
3045 | * @param {*} value The value to process.
|
3046 | * @returns {string} Returns the string.
|
3047 | * @example
|
3048 | *
|
3049 | * _.toString(null);
|
3050 | * // => ''
|
3051 | *
|
3052 | * _.toString(-0);
|
3053 | * // => '-0'
|
3054 | *
|
3055 | * _.toString([1, 2, 3]);
|
3056 | * // => '1,2,3'
|
3057 | */
|
3058 | function toString(value) {
|
3059 | // Exit early for strings to avoid a performance hit in some environments.
|
3060 | if (typeof value == 'string') {
|
3061 | return value;
|
3062 | }
|
3063 | if (value == null) {
|
3064 | return '';
|
3065 | }
|
3066 | if (isSymbol(value)) {
|
3067 | return symbolToString ? symbolToString.call(value) : '';
|
3068 | }
|
3069 | var result = (value + '');
|
3070 | return (result == '0' && (1 / value) == -INFINITY$1) ? '-0' : result;
|
3071 | }
|
3072 |
|
3073 | /** Used to match property names within property paths. */
|
3074 | var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]/g;
|
3075 |
|
3076 | /** Used to match backslashes in property paths. */
|
3077 | var reEscapeChar = /\\(\\)?/g;
|
3078 |
|
3079 | /**
|
3080 | * Converts `string` to a property path array.
|
3081 | *
|
3082 | * @private
|
3083 | * @param {string} string The string to convert.
|
3084 | * @returns {Array} Returns the property path array.
|
3085 | */
|
3086 | function stringToPath(string) {
|
3087 | var result = [];
|
3088 | toString(string).replace(rePropName, function(match, number, quote, string) {
|
3089 | result.push(quote ? string.replace(reEscapeChar, '$1') : (number || match));
|
3090 | });
|
3091 | return result;
|
3092 | }
|
3093 |
|
3094 | /**
|
3095 | * Casts `value` to a path array if it's not one.
|
3096 | *
|
3097 | * @private
|
3098 | * @param {*} value The value to inspect.
|
3099 | * @returns {Array} Returns the cast property path array.
|
3100 | */
|
3101 | function baseCastPath(value) {
|
3102 | return isArray(value) ? value : stringToPath(value);
|
3103 | }
|
3104 |
|
3105 | var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
|
3106 | var reIsPlainProp = /^\w*$/;
|
3107 | /**
|
3108 | * Checks if `value` is a property name and not a property path.
|
3109 | *
|
3110 | * @private
|
3111 | * @param {*} value The value to check.
|
3112 | * @param {Object} [object] The object to query keys on.
|
3113 | * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
|
3114 | */
|
3115 | function isKey(value, object) {
|
3116 | if (typeof value == 'number') {
|
3117 | return true;
|
3118 | }
|
3119 | return !isArray(value) &&
|
3120 | (reIsPlainProp.test(value) || !reIsDeepProp.test(value) ||
|
3121 | (object != null && value in Object(object)));
|
3122 | }
|
3123 |
|
3124 | /**
|
3125 | * Gets the last element of `array`.
|
3126 | *
|
3127 | * @static
|
3128 | * @memberOf _
|
3129 | * @category Array
|
3130 | * @param {Array} array The array to query.
|
3131 | * @returns {*} Returns the last element of `array`.
|
3132 | * @example
|
3133 | *
|
3134 | * _.last([1, 2, 3]);
|
3135 | * // => 3
|
3136 | */
|
3137 | function last(array) {
|
3138 | var length = array ? array.length : 0;
|
3139 | return length ? array[length - 1] : undefined;
|
3140 | }
|
3141 |
|
3142 | /**
|
3143 | * The base implementation of `_.slice` without an iteratee call guard.
|
3144 | *
|
3145 | * @private
|
3146 | * @param {Array} array The array to slice.
|
3147 | * @param {number} [start=0] The start position.
|
3148 | * @param {number} [end=array.length] The end position.
|
3149 | * @returns {Array} Returns the slice of `array`.
|
3150 | */
|
3151 | function baseSlice(array, start, end) {
|
3152 | var index = -1,
|
3153 | length = array.length;
|
3154 |
|
3155 | if (start < 0) {
|
3156 | start = -start > length ? 0 : (length + start);
|
3157 | }
|
3158 | end = end > length ? length : end;
|
3159 | if (end < 0) {
|
3160 | end += length;
|
3161 | }
|
3162 | length = start > end ? 0 : ((end - start) >>> 0);
|
3163 | start >>>= 0;
|
3164 |
|
3165 | var result = Array(length);
|
3166 | while (++index < length) {
|
3167 | result[index] = array[index + start];
|
3168 | }
|
3169 | return result;
|
3170 | }
|
3171 |
|
3172 | /**
|
3173 | * The base implementation of `_.get` without support for default values.
|
3174 | *
|
3175 | * @private
|
3176 | * @param {Object} object The object to query.
|
3177 | * @param {Array|string} path The path of the property to get.
|
3178 | * @returns {*} Returns the resolved value.
|
3179 | */
|
3180 | function baseGet(object, path) {
|
3181 | path = isKey(path, object) ? [path + ''] : baseCastPath(path);
|
3182 |
|
3183 | var index = 0,
|
3184 | length = path.length;
|
3185 |
|
3186 | while (object != null && index < length) {
|
3187 | object = object[path[index++]];
|
3188 | }
|
3189 | return (index && index == length) ? object : undefined;
|
3190 | }
|
3191 |
|
3192 | /**
|
3193 | * Gets the value at `path` of `object`. If the resolved value is
|
3194 | * `undefined` the `defaultValue` is used in its place.
|
3195 | *
|
3196 | * @static
|
3197 | * @memberOf _
|
3198 | * @category Object
|
3199 | * @param {Object} object The object to query.
|
3200 | * @param {Array|string} path The path of the property to get.
|
3201 | * @param {*} [defaultValue] The value returned if the resolved value is `undefined`.
|
3202 | * @returns {*} Returns the resolved value.
|
3203 | * @example
|
3204 | *
|
3205 | * var object = { 'a': [{ 'b': { 'c': 3 } }] };
|
3206 | *
|
3207 | * _.get(object, 'a[0].b.c');
|
3208 | * // => 3
|
3209 | *
|
3210 | * _.get(object, ['a', '0', 'b', 'c']);
|
3211 | * // => 3
|
3212 | *
|
3213 | * _.get(object, 'a.b.c', 'default');
|
3214 | * // => 'default'
|
3215 | */
|
3216 | function get(object, path, defaultValue) {
|
3217 | var result = object == null ? undefined : baseGet(object, path);
|
3218 | return result === undefined ? defaultValue : result;
|
3219 | }
|
3220 |
|
3221 | /**
|
3222 | * Gets the parent value at `path` of `object`.
|
3223 | *
|
3224 | * @private
|
3225 | * @param {Object} object The object to query.
|
3226 | * @param {Array} path The path to get the parent value of.
|
3227 | * @returns {*} Returns the parent value.
|
3228 | */
|
3229 | function parent(object, path) {
|
3230 | return path.length == 1 ? object : get(object, baseSlice(path, 0, -1));
|
3231 | }
|
3232 |
|
3233 | /**
|
3234 | * Checks if `path` exists on `object`.
|
3235 | *
|
3236 | * @private
|
3237 | * @param {Object} object The object to query.
|
3238 | * @param {Array|string} path The path to check.
|
3239 | * @param {Function} hasFunc The function to check properties.
|
3240 | * @returns {boolean} Returns `true` if `path` exists, else `false`.
|
3241 | */
|
3242 | function hasPath(object, path, hasFunc) {
|
3243 | if (object == null) {
|
3244 | return false;
|
3245 | }
|
3246 | var result = hasFunc(object, path);
|
3247 | if (!result && !isKey(path)) {
|
3248 | path = baseCastPath(path);
|
3249 | object = parent(object, path);
|
3250 | if (object != null) {
|
3251 | path = last(path);
|
3252 | result = hasFunc(object, path);
|
3253 | }
|
3254 | }
|
3255 | var length = object ? object.length : undefined;
|
3256 | return result || (
|
3257 | !!length && isLength(length) && isIndex(path, length) &&
|
3258 | (isArray(object) || isString(object) || isArguments(object))
|
3259 | );
|
3260 | }
|
3261 |
|
3262 | /**
|
3263 | * Checks if `path` is a direct property of `object`.
|
3264 | *
|
3265 | * @static
|
3266 | * @memberOf _
|
3267 | * @category Object
|
3268 | * @param {Object} object The object to query.
|
3269 | * @param {Array|string} path The path to check.
|
3270 | * @returns {boolean} Returns `true` if `path` exists, else `false`.
|
3271 | * @example
|
3272 | *
|
3273 | * var object = { 'a': { 'b': { 'c': 3 } } };
|
3274 | * var other = _.create({ 'a': _.create({ 'b': _.create({ 'c': 3 }) }) });
|
3275 | *
|
3276 | * _.has(object, 'a');
|
3277 | * // => true
|
3278 | *
|
3279 | * _.has(object, 'a.b.c');
|
3280 | * // => true
|
3281 | *
|
3282 | * _.has(object, ['a', 'b', 'c']);
|
3283 | * // => true
|
3284 | *
|
3285 | * _.has(other, 'a');
|
3286 | * // => false
|
3287 | */
|
3288 | function has(object, path) {
|
3289 | return hasPath(object, path, baseHas);
|
3290 | }
|
3291 |
|
3292 | function memoize(fn, hasher) {
|
3293 | var memo = Object.create(null);
|
3294 | var queues = Object.create(null);
|
3295 | hasher = hasher || identity;
|
3296 | var memoized = initialParams(function memoized(args, callback) {
|
3297 | var key = hasher.apply(null, args);
|
3298 | if (has(memo, key)) {
|
3299 | setImmediate$1(function () {
|
3300 | callback.apply(null, memo[key]);
|
3301 | });
|
3302 | } else if (has(queues, key)) {
|
3303 | queues[key].push(callback);
|
3304 | } else {
|
3305 | queues[key] = [callback];
|
3306 | fn.apply(null, args.concat([rest(function (args) {
|
3307 | memo[key] = args;
|
3308 | var q = queues[key];
|
3309 | delete queues[key];
|
3310 | for (var i = 0, l = q.length; i < l; i++) {
|
3311 | q[i].apply(null, args);
|
3312 | }
|
3313 | })]));
|
3314 | }
|
3315 | });
|
3316 | memoized.memo = memo;
|
3317 | memoized.unmemoized = fn;
|
3318 | return memoized;
|
3319 | }
|
3320 |
|
3321 | function _parallel(eachfn, tasks, callback) {
|
3322 | callback = callback || noop;
|
3323 | var results = isArrayLike(tasks) ? [] : {};
|
3324 |
|
3325 | eachfn(tasks, function (task, key, callback) {
|
3326 | task(rest(function (err, args) {
|
3327 | if (args.length <= 1) {
|
3328 | args = args[0];
|
3329 | }
|
3330 | results[key] = args;
|
3331 | callback(err);
|
3332 | }));
|
3333 | }, function (err) {
|
3334 | callback(err, results);
|
3335 | });
|
3336 | }
|
3337 |
|
3338 | function parallelLimit(tasks, limit, cb) {
|
3339 | return _parallel(_eachOfLimit(limit), tasks, cb);
|
3340 | }
|
3341 |
|
3342 | var parallel = doLimit(parallelLimit, Infinity);
|
3343 |
|
3344 | function queue$1 (worker, concurrency) {
|
3345 | return queue(function (items, cb) {
|
3346 | worker(items[0], cb);
|
3347 | }, concurrency, 1);
|
3348 | }
|
3349 |
|
3350 | function priorityQueue (worker, concurrency) {
|
3351 | function _compareTasks(a, b) {
|
3352 | return a.priority - b.priority;
|
3353 | }
|
3354 |
|
3355 | function _binarySearch(sequence, item, compare) {
|
3356 | var beg = -1,
|
3357 | end = sequence.length - 1;
|
3358 | while (beg < end) {
|
3359 | var mid = beg + (end - beg + 1 >>> 1);
|
3360 | if (compare(item, sequence[mid]) >= 0) {
|
3361 | beg = mid;
|
3362 | } else {
|
3363 | end = mid - 1;
|
3364 | }
|
3365 | }
|
3366 | return beg;
|
3367 | }
|
3368 |
|
3369 | function _insert(q, data, priority, callback) {
|
3370 | if (callback != null && typeof callback !== 'function') {
|
3371 | throw new Error('task callback must be a function');
|
3372 | }
|
3373 | q.started = true;
|
3374 | if (!isArray(data)) {
|
3375 | data = [data];
|
3376 | }
|
3377 | if (data.length === 0) {
|
3378 | // call drain immediately if there are no tasks
|
3379 | return setImmediate$1(function () {
|
3380 | q.drain();
|
3381 | });
|
3382 | }
|
3383 | arrayEach(data, function (task) {
|
3384 | var item = {
|
3385 | data: task,
|
3386 | priority: priority,
|
3387 | callback: typeof callback === 'function' ? callback : noop
|
3388 | };
|
3389 |
|
3390 | q.tasks.splice(_binarySearch(q.tasks, item, _compareTasks) + 1, 0, item);
|
3391 |
|
3392 | if (q.tasks.length === q.concurrency) {
|
3393 | q.saturated();
|
3394 | }
|
3395 | if (q.tasks.length <= q.concurrency - q.buffer) {
|
3396 | q.unsaturated();
|
3397 | }
|
3398 | setImmediate$1(q.process);
|
3399 | });
|
3400 | }
|
3401 |
|
3402 | // Start with a normal queue
|
3403 | var q = queue$1(worker, concurrency);
|
3404 |
|
3405 | // Override push to accept second parameter representing priority
|
3406 | q.push = function (data, priority, callback) {
|
3407 | _insert(q, data, priority, callback);
|
3408 | };
|
3409 |
|
3410 | // Remove unshift function
|
3411 | delete q.unshift;
|
3412 |
|
3413 | return q;
|
3414 | }
|
3415 |
|
3416 | /**
|
3417 | * Creates a `baseEach` or `baseEachRight` function.
|
3418 | *
|
3419 | * @private
|
3420 | * @param {Function} eachFunc The function to iterate over a collection.
|
3421 | * @param {boolean} [fromRight] Specify iterating from right to left.
|
3422 | * @returns {Function} Returns the new base function.
|
3423 | */
|
3424 | function createBaseEach(eachFunc, fromRight) {
|
3425 | return function(collection, iteratee) {
|
3426 | if (collection == null) {
|
3427 | return collection;
|
3428 | }
|
3429 | if (!isArrayLike(collection)) {
|
3430 | return eachFunc(collection, iteratee);
|
3431 | }
|
3432 | var length = collection.length,
|
3433 | index = fromRight ? length : -1,
|
3434 | iterable = Object(collection);
|
3435 |
|
3436 | while ((fromRight ? index-- : ++index < length)) {
|
3437 | if (iteratee(iterable[index], index, iterable) === false) {
|
3438 | break;
|
3439 | }
|
3440 | }
|
3441 | return collection;
|
3442 | };
|
3443 | }
|
3444 |
|
3445 | /**
|
3446 | * The base implementation of `_.forEach` without support for iteratee shorthands.
|
3447 | *
|
3448 | * @private
|
3449 | * @param {Array|Object} collection The collection to iterate over.
|
3450 | * @param {Function} iteratee The function invoked per iteration.
|
3451 | * @returns {Array|Object} Returns `collection`.
|
3452 | */
|
3453 | var baseEach = createBaseEach(baseForOwn);
|
3454 |
|
3455 | /**
|
3456 | * Iterates over elements of `collection` invoking `iteratee` for each element.
|
3457 | * The iteratee is invoked with three arguments: (value, index|key, collection).
|
3458 | * Iteratee functions may exit iteration early by explicitly returning `false`.
|
3459 | *
|
3460 | * **Note:** As with other "Collections" methods, objects with a "length" property
|
3461 | * are iterated like arrays. To avoid this behavior use `_.forIn` or `_.forOwn`
|
3462 | * for object iteration.
|
3463 | *
|
3464 | * @static
|
3465 | * @memberOf _
|
3466 | * @alias each
|
3467 | * @category Collection
|
3468 | * @param {Array|Object} collection The collection to iterate over.
|
3469 | * @param {Function} [iteratee=_.identity] The function invoked per iteration.
|
3470 | * @returns {Array|Object} Returns `collection`.
|
3471 | * @example
|
3472 | *
|
3473 | * _([1, 2]).forEach(function(value) {
|
3474 | * console.log(value);
|
3475 | * });
|
3476 | * // => logs `1` then `2`
|
3477 | *
|
3478 | * _.forEach({ 'a': 1, 'b': 2 }, function(value, key) {
|
3479 | * console.log(key);
|
3480 | * });
|
3481 | * // => logs 'a' then 'b' (iteration order is not guaranteed)
|
3482 | */
|
3483 | function forEach(collection, iteratee) {
|
3484 | return (typeof iteratee == 'function' && isArray(collection))
|
3485 | ? arrayEach(collection, iteratee)
|
3486 | : baseEach(collection, baseCastFunction(iteratee));
|
3487 | }
|
3488 |
|
3489 | function race(tasks, cb) {
|
3490 | cb = once(cb || noop);
|
3491 | if (!isArray(tasks)) return cb(new TypeError('First argument to race must be an array of functions'));
|
3492 | if (!tasks.length) return cb();
|
3493 | forEach(tasks, function (task) {
|
3494 | task(cb);
|
3495 | });
|
3496 | }
|
3497 |
|
3498 | var slice = Array.prototype.slice;
|
3499 |
|
3500 | function reduceRight(arr, memo, iteratee, cb) {
|
3501 | var reversed = slice.call(arr).reverse();
|
3502 | reduce(reversed, memo, iteratee, cb);
|
3503 | }
|
3504 |
|
3505 | function reject$1(eachfn, arr, iteratee, callback) {
|
3506 | _filter(eachfn, arr, function (value, cb) {
|
3507 | iteratee(value, function (err, v) {
|
3508 | if (err) {
|
3509 | cb(err);
|
3510 | } else {
|
3511 | cb(null, !v);
|
3512 | }
|
3513 | });
|
3514 | }, callback);
|
3515 | }
|
3516 |
|
3517 | var rejectLimit = doParallelLimit(reject$1);
|
3518 |
|
3519 | var reject = doLimit(rejectLimit, Infinity);
|
3520 |
|
3521 | var rejectSeries = doLimit(rejectLimit, 1);
|
3522 |
|
3523 | function series(tasks, cb) {
|
3524 | return _parallel(eachOfSeries, tasks, cb);
|
3525 | }
|
3526 |
|
3527 | function retry(times, task, callback) {
|
3528 | var DEFAULT_TIMES = 5;
|
3529 | var DEFAULT_INTERVAL = 0;
|
3530 |
|
3531 | var opts = {
|
3532 | times: DEFAULT_TIMES,
|
3533 | interval: DEFAULT_INTERVAL
|
3534 | };
|
3535 |
|
3536 | function parseTimes(acc, t) {
|
3537 | if (typeof t === 'object') {
|
3538 | acc.times = +t.times || DEFAULT_TIMES;
|
3539 | acc.interval = +t.interval || DEFAULT_INTERVAL;
|
3540 | } else if (typeof t === 'number' || typeof t === 'string') {
|
3541 | acc.times = +t || DEFAULT_TIMES;
|
3542 | } else {
|
3543 | throw new Error("Invalid arguments for async.retry");
|
3544 | }
|
3545 | }
|
3546 |
|
3547 | if (arguments.length < 3 && typeof times === 'function') {
|
3548 | callback = task || noop;
|
3549 | task = times;
|
3550 | } else {
|
3551 | parseTimes(opts, times);
|
3552 | callback = callback || noop;
|
3553 | }
|
3554 |
|
3555 | if (typeof task !== 'function') {
|
3556 | throw new Error("Invalid arguments for async.retry");
|
3557 | }
|
3558 |
|
3559 | var attempts = [];
|
3560 | while (opts.times) {
|
3561 | var isFinalAttempt = !(opts.times -= 1);
|
3562 | attempts.push(retryAttempt(isFinalAttempt));
|
3563 | if (!isFinalAttempt && opts.interval > 0) {
|
3564 | attempts.push(retryInterval(opts.interval));
|
3565 | }
|
3566 | }
|
3567 |
|
3568 | series(attempts, function (done, data) {
|
3569 | data = data[data.length - 1];
|
3570 | callback(data.err, data.result);
|
3571 | });
|
3572 |
|
3573 | function retryAttempt(isFinalAttempt) {
|
3574 | return function (seriesCallback) {
|
3575 | task(function (err, result) {
|
3576 | seriesCallback(!err || isFinalAttempt, {
|
3577 | err: err,
|
3578 | result: result
|
3579 | });
|
3580 | });
|
3581 | };
|
3582 | }
|
3583 |
|
3584 | function retryInterval(interval) {
|
3585 | return function (seriesCallback) {
|
3586 | setTimeout(function () {
|
3587 | seriesCallback(null);
|
3588 | }, interval);
|
3589 | };
|
3590 | }
|
3591 | }
|
3592 |
|
3593 | function retryable (opts, task) {
|
3594 | if (!task) {
|
3595 | task = opts;
|
3596 | opts = null;
|
3597 | }
|
3598 | return initialParams(function (args, callback) {
|
3599 | function taskFn(cb) {
|
3600 | task.apply(null, args.concat([cb]));
|
3601 | }
|
3602 |
|
3603 | if (opts) retry(opts, taskFn, callback);else retry(taskFn, callback);
|
3604 | });
|
3605 | }
|
3606 |
|
3607 | var someLimit = _createTester(eachOfLimit, Boolean, identity);
|
3608 |
|
3609 | var some = doLimit(someLimit, Infinity);
|
3610 |
|
3611 | var someSeries = doLimit(someLimit, 1);
|
3612 |
|
3613 | function sortBy(arr, iteratee, cb) {
|
3614 | map(arr, function (x, cb) {
|
3615 | iteratee(x, function (err, criteria) {
|
3616 | if (err) return cb(err);
|
3617 | cb(null, { value: x, criteria: criteria });
|
3618 | });
|
3619 | }, function (err, results) {
|
3620 | if (err) return cb(err);
|
3621 | cb(null, arrayMap(results.sort(comparator), baseProperty('value')));
|
3622 | });
|
3623 |
|
3624 | function comparator(left, right) {
|
3625 | var a = left.criteria,
|
3626 | b = right.criteria;
|
3627 | return a < b ? -1 : a > b ? 1 : 0;
|
3628 | }
|
3629 | }
|
3630 |
|
3631 | function timeout(asyncFn, miliseconds) {
|
3632 | var originalCallback, timer;
|
3633 | var timedOut = false;
|
3634 |
|
3635 | function injectedCallback() {
|
3636 | if (!timedOut) {
|
3637 | originalCallback.apply(null, arguments);
|
3638 | clearTimeout(timer);
|
3639 | }
|
3640 | }
|
3641 |
|
3642 | function timeoutCallback() {
|
3643 | var error = new Error('Callback function timed out.');
|
3644 | error.code = 'ETIMEDOUT';
|
3645 | timedOut = true;
|
3646 | originalCallback(error);
|
3647 | }
|
3648 |
|
3649 | return initialParams(function (args, origCallback) {
|
3650 | originalCallback = origCallback;
|
3651 | // setup timer and call original function
|
3652 | timer = setTimeout(timeoutCallback, miliseconds);
|
3653 | asyncFn.apply(null, args.concat(injectedCallback));
|
3654 | });
|
3655 | }
|
3656 |
|
3657 | /* Built-in method references for those with the same name as other `lodash` methods. */
|
3658 | var nativeCeil = Math.ceil;
|
3659 | var nativeMax$2 = Math.max;
|
3660 | /**
|
3661 | * The base implementation of `_.range` and `_.rangeRight` which doesn't
|
3662 | * coerce arguments to numbers.
|
3663 | *
|
3664 | * @private
|
3665 | * @param {number} start The start of the range.
|
3666 | * @param {number} end The end of the range.
|
3667 | * @param {number} step The value to increment or decrement by.
|
3668 | * @param {boolean} [fromRight] Specify iterating from right to left.
|
3669 | * @returns {Array} Returns the new array of numbers.
|
3670 | */
|
3671 | function baseRange(start, end, step, fromRight) {
|
3672 | var index = -1,
|
3673 | length = nativeMax$2(nativeCeil((end - start) / (step || 1)), 0),
|
3674 | result = Array(length);
|
3675 |
|
3676 | while (length--) {
|
3677 | result[fromRight ? length : ++index] = start;
|
3678 | start += step;
|
3679 | }
|
3680 | return result;
|
3681 | }
|
3682 |
|
3683 | function timeLimit(count, limit, iteratee, cb) {
|
3684 | return mapLimit(baseRange(0, count, 1), limit, iteratee, cb);
|
3685 | }
|
3686 |
|
3687 | var times = doLimit(timeLimit, Infinity);
|
3688 |
|
3689 | var timesSeries = doLimit(timeLimit, 1);
|
3690 |
|
3691 | function transform(arr, memo, iteratee, callback) {
|
3692 | if (arguments.length === 3) {
|
3693 | callback = iteratee;
|
3694 | iteratee = memo;
|
3695 | memo = isArray(arr) ? [] : {};
|
3696 | }
|
3697 |
|
3698 | eachOf(arr, function (v, k, cb) {
|
3699 | iteratee(memo, v, k, cb);
|
3700 | }, function (err) {
|
3701 | callback(err, memo);
|
3702 | });
|
3703 | }
|
3704 |
|
3705 | function unmemoize(fn) {
|
3706 | return function () {
|
3707 | return (fn.unmemoized || fn).apply(null, arguments);
|
3708 | };
|
3709 | }
|
3710 |
|
3711 | function until(test, iteratee, cb) {
|
3712 | return whilst(function () {
|
3713 | return !test.apply(this, arguments);
|
3714 | }, iteratee, cb);
|
3715 | }
|
3716 |
|
3717 | function waterfall (tasks, cb) {
|
3718 | cb = once(cb || noop);
|
3719 | if (!isArray(tasks)) return cb(new Error('First argument to waterfall must be an array of functions'));
|
3720 | if (!tasks.length) return cb();
|
3721 | var taskIndex = 0;
|
3722 |
|
3723 | function nextTask(args) {
|
3724 | if (taskIndex === tasks.length) {
|
3725 | return cb.apply(null, [null].concat(args));
|
3726 | }
|
3727 |
|
3728 | var taskCallback = onlyOnce(rest(function (err, args) {
|
3729 | if (err) {
|
3730 | return cb.apply(null, [err].concat(args));
|
3731 | }
|
3732 | nextTask(args);
|
3733 | }));
|
3734 |
|
3735 | args.push(taskCallback);
|
3736 |
|
3737 | var task = tasks[taskIndex++];
|
3738 | task.apply(null, args);
|
3739 | }
|
3740 |
|
3741 | nextTask([]);
|
3742 | }
|
3743 |
|
3744 | var index = {
|
3745 | applyEach: applyEach,
|
3746 | applyEachSeries: applyEachSeries,
|
3747 | apply: apply$1,
|
3748 | asyncify: asyncify,
|
3749 | auto: auto,
|
3750 | autoInject: autoInject,
|
3751 | cargo: cargo,
|
3752 | compose: compose,
|
3753 | concat: concat,
|
3754 | concatSeries: concatSeries,
|
3755 | constant: constant$1,
|
3756 | detect: detect,
|
3757 | detectLimit: detectLimit,
|
3758 | detectSeries: detectSeries,
|
3759 | dir: dir,
|
3760 | doDuring: doDuring,
|
3761 | doUntil: doUntil,
|
3762 | doWhilst: doWhilst,
|
3763 | during: during,
|
3764 | each: each,
|
3765 | eachLimit: eachLimit,
|
3766 | eachOf: eachOf,
|
3767 | eachOfLimit: eachOfLimit,
|
3768 | eachOfSeries: eachOfSeries,
|
3769 | eachSeries: eachSeries,
|
3770 | ensureAsync: ensureAsync,
|
3771 | every: every,
|
3772 | everyLimit: everyLimit,
|
3773 | everySeries: everySeries,
|
3774 | filter: filter,
|
3775 | filterLimit: filterLimit,
|
3776 | filterSeries: filterSeries,
|
3777 | forever: forever,
|
3778 | iterator: iterator$1,
|
3779 | log: log,
|
3780 | map: map,
|
3781 | mapLimit: mapLimit,
|
3782 | mapSeries: mapSeries,
|
3783 | memoize: memoize,
|
3784 | nextTick: setImmediate$1,
|
3785 | parallel: parallel,
|
3786 | parallelLimit: parallelLimit,
|
3787 | priorityQueue: priorityQueue,
|
3788 | queue: queue$1,
|
3789 | race: race,
|
3790 | reduce: reduce,
|
3791 | reduceRight: reduceRight,
|
3792 | reject: reject,
|
3793 | rejectLimit: rejectLimit,
|
3794 | rejectSeries: rejectSeries,
|
3795 | retry: retry,
|
3796 | retryable: retryable,
|
3797 | seq: seq,
|
3798 | series: series,
|
3799 | setImmediate: setImmediate$1,
|
3800 | some: some,
|
3801 | someLimit: someLimit,
|
3802 | someSeries: someSeries,
|
3803 | sortBy: sortBy,
|
3804 | timeout: timeout,
|
3805 | times: times,
|
3806 | timesLimit: timeLimit,
|
3807 | timesSeries: timesSeries,
|
3808 | transform: transform,
|
3809 | unmemoize: unmemoize,
|
3810 | until: until,
|
3811 | waterfall: waterfall,
|
3812 | whilst: whilst,
|
3813 |
|
3814 | // aliases
|
3815 | all: every,
|
3816 | any: some,
|
3817 | forEach: each,
|
3818 | forEachSeries: eachSeries,
|
3819 | forEachLimit: eachLimit,
|
3820 | forEachOf: eachOf,
|
3821 | forEachOfSeries: eachOfSeries,
|
3822 | forEachOfLimit: eachOfLimit,
|
3823 | inject: reduce,
|
3824 | foldl: reduce,
|
3825 | foldr: reduceRight,
|
3826 | select: filter,
|
3827 | selectLimit: filterLimit,
|
3828 | selectSeries: filterSeries,
|
3829 | wrapSync: asyncify
|
3830 | };
|
3831 |
|
3832 | exports['default'] = index;
|
3833 | exports.applyEach = applyEach;
|
3834 | exports.applyEachSeries = applyEachSeries;
|
3835 | exports.apply = apply$1;
|
3836 | exports.asyncify = asyncify;
|
3837 | exports.auto = auto;
|
3838 | exports.autoInject = autoInject;
|
3839 | exports.cargo = cargo;
|
3840 | exports.compose = compose;
|
3841 | exports.concat = concat;
|
3842 | exports.concatSeries = concatSeries;
|
3843 | exports.constant = constant$1;
|
3844 | exports.detect = detect;
|
3845 | exports.detectLimit = detectLimit;
|
3846 | exports.detectSeries = detectSeries;
|
3847 | exports.dir = dir;
|
3848 | exports.doDuring = doDuring;
|
3849 | exports.doUntil = doUntil;
|
3850 | exports.doWhilst = doWhilst;
|
3851 | exports.during = during;
|
3852 | exports.each = each;
|
3853 | exports.eachLimit = eachLimit;
|
3854 | exports.eachOf = eachOf;
|
3855 | exports.eachOfLimit = eachOfLimit;
|
3856 | exports.eachOfSeries = eachOfSeries;
|
3857 | exports.eachSeries = eachSeries;
|
3858 | exports.ensureAsync = ensureAsync;
|
3859 | exports.every = every;
|
3860 | exports.everyLimit = everyLimit;
|
3861 | exports.everySeries = everySeries;
|
3862 | exports.filter = filter;
|
3863 | exports.filterLimit = filterLimit;
|
3864 | exports.filterSeries = filterSeries;
|
3865 | exports.forever = forever;
|
3866 | exports.iterator = iterator$1;
|
3867 | exports.log = log;
|
3868 | exports.map = map;
|
3869 | exports.mapLimit = mapLimit;
|
3870 | exports.mapSeries = mapSeries;
|
3871 | exports.memoize = memoize;
|
3872 | exports.nextTick = setImmediate$1;
|
3873 | exports.parallel = parallel;
|
3874 | exports.parallelLimit = parallelLimit;
|
3875 | exports.priorityQueue = priorityQueue;
|
3876 | exports.queue = queue$1;
|
3877 | exports.race = race;
|
3878 | exports.reduce = reduce;
|
3879 | exports.reduceRight = reduceRight;
|
3880 | exports.reject = reject;
|
3881 | exports.rejectLimit = rejectLimit;
|
3882 | exports.rejectSeries = rejectSeries;
|
3883 | exports.retry = retry;
|
3884 | exports.retryable = retryable;
|
3885 | exports.seq = seq;
|
3886 | exports.series = series;
|
3887 | exports.setImmediate = setImmediate$1;
|
3888 | exports.some = some;
|
3889 | exports.someLimit = someLimit;
|
3890 | exports.someSeries = someSeries;
|
3891 | exports.sortBy = sortBy;
|
3892 | exports.timeout = timeout;
|
3893 | exports.times = times;
|
3894 | exports.timesLimit = timeLimit;
|
3895 | exports.timesSeries = timesSeries;
|
3896 | exports.transform = transform;
|
3897 | exports.unmemoize = unmemoize;
|
3898 | exports.until = until;
|
3899 | exports.waterfall = waterfall;
|
3900 | exports.whilst = whilst;
|
3901 | exports.all = every;
|
3902 | exports.allLimit = everyLimit;
|
3903 | exports.allSeries = everySeries;
|
3904 | exports.any = some;
|
3905 | exports.anyLimit = someLimit;
|
3906 | exports.anySeries = someSeries;
|
3907 | exports.find = detect;
|
3908 | exports.findLimit = detectLimit;
|
3909 | exports.findSeries = detectSeries;
|
3910 | exports.forEach = each;
|
3911 | exports.forEachSeries = eachSeries;
|
3912 | exports.forEachLimit = eachLimit;
|
3913 | exports.forEachOf = eachOf;
|
3914 | exports.forEachOfSeries = eachOfSeries;
|
3915 | exports.forEachOfLimit = eachOfLimit;
|
3916 | exports.inject = reduce;
|
3917 | exports.foldl = reduce;
|
3918 | exports.foldr = reduceRight;
|
3919 | exports.select = filter;
|
3920 | exports.selectLimit = filterLimit;
|
3921 | exports.selectSeries = filterSeries;
|
3922 | exports.wrapSync = asyncify;
|
3923 |
|
3924 | })); |
\ | No newline at end of file |