박지환

Separate android and nodejs

Showing 1000 changed files with 0 additions and 4765 deletions

Too many changes to show.

To preserve performance only 1000 of 1000+ files are displayed.

1 -Subproject commit cc12bd6bf562dd7938b8e9b63f2dd40057afc541
1 -../ejs/bin/cli.js
...\ No newline at end of file ...\ No newline at end of file
1 -../jake/bin/cli.js
...\ No newline at end of file ...\ No newline at end of file
1 -../mime/cli.js
...\ No newline at end of file ...\ No newline at end of file
1 -../sshpk/bin/sshpk-conv
...\ No newline at end of file ...\ No newline at end of file
1 -../sshpk/bin/sshpk-sign
...\ No newline at end of file ...\ No newline at end of file
1 -../sshpk/bin/sshpk-verify
...\ No newline at end of file ...\ No newline at end of file
1 -../uuid/bin/uuid
...\ No newline at end of file ...\ No newline at end of file
1 -../xml-js/bin/cli.js
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -exports.default = mapValuesSeries;
7 -
8 -var _mapValuesLimit = require('./mapValuesLimit.js');
9 -
10 -var _mapValuesLimit2 = _interopRequireDefault(_mapValuesLimit);
11 -
12 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13 -
14 -/**
15 - * The same as [`mapValues`]{@link module:Collections.mapValues} but runs only a single async operation at a time.
16 - *
17 - * @name mapValuesSeries
18 - * @static
19 - * @memberOf module:Collections
20 - * @method
21 - * @see [async.mapValues]{@link module:Collections.mapValues}
22 - * @category Collection
23 - * @param {Object} obj - A collection to iterate over.
24 - * @param {AsyncFunction} iteratee - A function to apply to each value and key
25 - * in `coll`.
26 - * The iteratee should complete with the transformed value as its result.
27 - * Invoked with (value, key, callback).
28 - * @param {Function} [callback] - A callback which is called when all `iteratee`
29 - * functions have finished, or an error occurs. `result` is a new object consisting
30 - * of each key from `obj`, with each transformed value on the right-hand side.
31 - * Invoked with (err, result).
32 - * @returns {Promise} a promise, if no callback is passed
33 - */
34 -function mapValuesSeries(obj, iteratee, callback) {
35 - return (0, _mapValuesLimit2.default)(obj, 1, iteratee, callback);
36 -}
37 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -
7 -var _setImmediate = require('./internal/setImmediate.js');
8 -
9 -/**
10 - * Calls `callback` on a later loop around the event loop. In Node.js this just
11 - * calls `process.nextTick`. In the browser it will use `setImmediate` if
12 - * available, otherwise `setTimeout(callback, 0)`, which means other higher
13 - * priority events may precede the execution of `callback`.
14 - *
15 - * This is used internally for browser-compatibility purposes.
16 - *
17 - * @name nextTick
18 - * @static
19 - * @memberOf module:Utils
20 - * @method
21 - * @see [async.setImmediate]{@link module:Utils.setImmediate}
22 - * @category Util
23 - * @param {Function} callback - The function to call on a later loop around
24 - * the event loop. Invoked with (args...).
25 - * @param {...*} args... - any number of additional arguments to pass to the
26 - * callback on the next tick.
27 - * @example
28 - *
29 - * var call_order = [];
30 - * async.nextTick(function() {
31 - * call_order.push('two');
32 - * // call_order now equals ['one','two']
33 - * });
34 - * call_order.push('one');
35 - *
36 - * async.setImmediate(function (a, b, c) {
37 - * // a, b, and c equal 1, 2, and 3
38 - * }, 1, 2, 3);
39 - */
40 -var _defer; /* istanbul ignore file */
41 -
42 -
43 -if (_setImmediate.hasNextTick) {
44 - _defer = process.nextTick;
45 -} else if (_setImmediate.hasSetImmediate) {
46 - _defer = setImmediate;
47 -} else {
48 - _defer = _setImmediate.fallback;
49 -}
50 -
51 -exports.default = (0, _setImmediate.wrap)(_defer);
52 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -exports.default = parallelLimit;
7 -
8 -var _eachOfLimit = require('./internal/eachOfLimit.js');
9 -
10 -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
11 -
12 -var _parallel = require('./internal/parallel.js');
13 -
14 -var _parallel2 = _interopRequireDefault(_parallel);
15 -
16 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17 -
18 -/**
19 - * The same as [`parallel`]{@link module:ControlFlow.parallel} but runs a maximum of `limit` async operations at a
20 - * time.
21 - *
22 - * @name parallelLimit
23 - * @static
24 - * @memberOf module:ControlFlow
25 - * @method
26 - * @see [async.parallel]{@link module:ControlFlow.parallel}
27 - * @category Control Flow
28 - * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection of
29 - * [async functions]{@link AsyncFunction} to run.
30 - * Each async function can complete with any number of optional `result` values.
31 - * @param {number} limit - The maximum number of async operations at a time.
32 - * @param {Function} [callback] - An optional callback to run once all the
33 - * functions have completed successfully. This function gets a results array
34 - * (or object) containing all the result arguments passed to the task callbacks.
35 - * Invoked with (err, results).
36 - * @returns {Promise} a promise, if a callback is not passed
37 - */
38 -function parallelLimit(tasks, limit, callback) {
39 - return (0, _parallel2.default)((0, _eachOfLimit2.default)(limit), tasks, callback);
40 -}
41 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -
7 -var _once = require('./internal/once.js');
8 -
9 -var _once2 = _interopRequireDefault(_once);
10 -
11 -var _wrapAsync = require('./internal/wrapAsync.js');
12 -
13 -var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
14 -
15 -var _awaitify = require('./internal/awaitify.js');
16 -
17 -var _awaitify2 = _interopRequireDefault(_awaitify);
18 -
19 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 -
21 -/**
22 - * Runs the `tasks` array of functions in parallel, without waiting until the
23 - * previous function has completed. Once any of the `tasks` complete or pass an
24 - * error to its callback, the main `callback` is immediately called. It's
25 - * equivalent to `Promise.race()`.
26 - *
27 - * @name race
28 - * @static
29 - * @memberOf module:ControlFlow
30 - * @method
31 - * @category Control Flow
32 - * @param {Array} tasks - An array containing [async functions]{@link AsyncFunction}
33 - * to run. Each function can complete with an optional `result` value.
34 - * @param {Function} callback - A callback to run once any of the functions have
35 - * completed. This function gets an error or result from the first function that
36 - * completed. Invoked with (err, result).
37 - * @returns undefined
38 - * @example
39 - *
40 - * async.race([
41 - * function(callback) {
42 - * setTimeout(function() {
43 - * callback(null, 'one');
44 - * }, 200);
45 - * },
46 - * function(callback) {
47 - * setTimeout(function() {
48 - * callback(null, 'two');
49 - * }, 100);
50 - * }
51 - * ],
52 - * // main callback
53 - * function(err, result) {
54 - * // the result will be equal to 'two' as it finishes earlier
55 - * });
56 - */
57 -function race(tasks, callback) {
58 - callback = (0, _once2.default)(callback);
59 - if (!Array.isArray(tasks)) return callback(new TypeError('First argument to race must be an array of functions'));
60 - if (!tasks.length) return callback();
61 - for (var i = 0, l = tasks.length; i < l; i++) {
62 - (0, _wrapAsync2.default)(tasks[i])(callback);
63 - }
64 -}
65 -
66 -exports.default = (0, _awaitify2.default)(race, 2);
67 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -exports.default = reduceRight;
7 -
8 -var _reduce = require('./reduce.js');
9 -
10 -var _reduce2 = _interopRequireDefault(_reduce);
11 -
12 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13 -
14 -/**
15 - * Same as [`reduce`]{@link module:Collections.reduce}, only operates on `array` in reverse order.
16 - *
17 - * @name reduceRight
18 - * @static
19 - * @memberOf module:Collections
20 - * @method
21 - * @see [async.reduce]{@link module:Collections.reduce}
22 - * @alias foldr
23 - * @category Collection
24 - * @param {Array} array - A collection to iterate over.
25 - * @param {*} memo - The initial state of the reduction.
26 - * @param {AsyncFunction} iteratee - A function applied to each item in the
27 - * array to produce the next step in the reduction.
28 - * The `iteratee` should complete with the next state of the reduction.
29 - * If the iteratee completes with an error, the reduction is stopped and the
30 - * main `callback` is immediately called with the error.
31 - * Invoked with (memo, item, callback).
32 - * @param {Function} [callback] - A callback which is called after all the
33 - * `iteratee` functions have finished. Result is the reduced value. Invoked with
34 - * (err, result).
35 - * @returns {Promise} a promise, if no callback is passed
36 - */
37 -function reduceRight(array, memo, iteratee, callback) {
38 - var reversed = [...array].reverse();
39 - return (0, _reduce2.default)(reversed, memo, iteratee, callback);
40 -}
41 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -exports.default = reflect;
7 -
8 -var _initialParams = require('./internal/initialParams.js');
9 -
10 -var _initialParams2 = _interopRequireDefault(_initialParams);
11 -
12 -var _wrapAsync = require('./internal/wrapAsync.js');
13 -
14 -var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
15 -
16 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17 -
18 -/**
19 - * Wraps the async function in another function that always completes with a
20 - * result object, even when it errors.
21 - *
22 - * The result object has either the property `error` or `value`.
23 - *
24 - * @name reflect
25 - * @static
26 - * @memberOf module:Utils
27 - * @method
28 - * @category Util
29 - * @param {AsyncFunction} fn - The async function you want to wrap
30 - * @returns {Function} - A function that always passes null to it's callback as
31 - * the error. The second argument to the callback will be an `object` with
32 - * either an `error` or a `value` property.
33 - * @example
34 - *
35 - * async.parallel([
36 - * async.reflect(function(callback) {
37 - * // do some stuff ...
38 - * callback(null, 'one');
39 - * }),
40 - * async.reflect(function(callback) {
41 - * // do some more stuff but error ...
42 - * callback('bad stuff happened');
43 - * }),
44 - * async.reflect(function(callback) {
45 - * // do some more stuff ...
46 - * callback(null, 'two');
47 - * })
48 - * ],
49 - * // optional callback
50 - * function(err, results) {
51 - * // values
52 - * // results[0].value = 'one'
53 - * // results[1].error = 'bad stuff happened'
54 - * // results[2].value = 'two'
55 - * });
56 - */
57 -function reflect(fn) {
58 - var _fn = (0, _wrapAsync2.default)(fn);
59 - return (0, _initialParams2.default)(function reflectOn(args, reflectCallback) {
60 - args.push((error, ...cbArgs) => {
61 - let retVal = {};
62 - if (error) {
63 - retVal.error = error;
64 - }
65 - if (cbArgs.length > 0) {
66 - var value = cbArgs;
67 - if (cbArgs.length <= 1) {
68 - [value] = cbArgs;
69 - }
70 - retVal.value = value;
71 - }
72 - reflectCallback(null, retVal);
73 - });
74 -
75 - return _fn.apply(this, args);
76 - });
77 -}
78 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -exports.default = reflectAll;
7 -
8 -var _reflect = require('./reflect.js');
9 -
10 -var _reflect2 = _interopRequireDefault(_reflect);
11 -
12 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13 -
14 -/**
15 - * A helper function that wraps an array or an object of functions with `reflect`.
16 - *
17 - * @name reflectAll
18 - * @static
19 - * @memberOf module:Utils
20 - * @method
21 - * @see [async.reflect]{@link module:Utils.reflect}
22 - * @category Util
23 - * @param {Array|Object|Iterable} tasks - The collection of
24 - * [async functions]{@link AsyncFunction} to wrap in `async.reflect`.
25 - * @returns {Array} Returns an array of async functions, each wrapped in
26 - * `async.reflect`
27 - * @example
28 - *
29 - * let tasks = [
30 - * function(callback) {
31 - * setTimeout(function() {
32 - * callback(null, 'one');
33 - * }, 200);
34 - * },
35 - * function(callback) {
36 - * // do some more stuff but error ...
37 - * callback(new Error('bad stuff happened'));
38 - * },
39 - * function(callback) {
40 - * setTimeout(function() {
41 - * callback(null, 'two');
42 - * }, 100);
43 - * }
44 - * ];
45 - *
46 - * async.parallel(async.reflectAll(tasks),
47 - * // optional callback
48 - * function(err, results) {
49 - * // values
50 - * // results[0].value = 'one'
51 - * // results[1].error = Error('bad stuff happened')
52 - * // results[2].value = 'two'
53 - * });
54 - *
55 - * // an example using an object instead of an array
56 - * let tasks = {
57 - * one: function(callback) {
58 - * setTimeout(function() {
59 - * callback(null, 'one');
60 - * }, 200);
61 - * },
62 - * two: function(callback) {
63 - * callback('two');
64 - * },
65 - * three: function(callback) {
66 - * setTimeout(function() {
67 - * callback(null, 'three');
68 - * }, 100);
69 - * }
70 - * };
71 - *
72 - * async.parallel(async.reflectAll(tasks),
73 - * // optional callback
74 - * function(err, results) {
75 - * // values
76 - * // results.one.value = 'one'
77 - * // results.two.error = 'two'
78 - * // results.three.value = 'three'
79 - * });
80 - */
81 -function reflectAll(tasks) {
82 - var results;
83 - if (Array.isArray(tasks)) {
84 - results = tasks.map(_reflect2.default);
85 - } else {
86 - results = {};
87 - Object.keys(tasks).forEach(key => {
88 - results[key] = _reflect2.default.call(this, tasks[key]);
89 - });
90 - }
91 - return results;
92 -}
93 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -
7 -var _reject2 = require('./internal/reject.js');
8 -
9 -var _reject3 = _interopRequireDefault(_reject2);
10 -
11 -var _eachOfLimit = require('./internal/eachOfLimit.js');
12 -
13 -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
14 -
15 -var _awaitify = require('./internal/awaitify.js');
16 -
17 -var _awaitify2 = _interopRequireDefault(_awaitify);
18 -
19 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 -
21 -/**
22 - * The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a
23 - * time.
24 - *
25 - * @name rejectLimit
26 - * @static
27 - * @memberOf module:Collections
28 - * @method
29 - * @see [async.reject]{@link module:Collections.reject}
30 - * @category Collection
31 - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 - * @param {number} limit - The maximum number of async operations at a time.
33 - * @param {Function} iteratee - An async truth test to apply to each item in
34 - * `coll`.
35 - * The should complete with a boolean value as its `result`.
36 - * Invoked with (item, callback).
37 - * @param {Function} [callback] - A callback which is called after all the
38 - * `iteratee` functions have finished. Invoked with (err, results).
39 - * @returns {Promise} a promise, if no callback is passed
40 - */
41 -function rejectLimit(coll, limit, iteratee, callback) {
42 - return (0, _reject3.default)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
43 -}
44 -exports.default = (0, _awaitify2.default)(rejectLimit, 4);
45 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -
7 -var _reject2 = require('./internal/reject.js');
8 -
9 -var _reject3 = _interopRequireDefault(_reject2);
10 -
11 -var _eachOfSeries = require('./eachOfSeries.js');
12 -
13 -var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
14 -
15 -var _awaitify = require('./internal/awaitify.js');
16 -
17 -var _awaitify2 = _interopRequireDefault(_awaitify);
18 -
19 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 -
21 -/**
22 - * The same as [`reject`]{@link module:Collections.reject} but runs only a single async operation at a time.
23 - *
24 - * @name rejectSeries
25 - * @static
26 - * @memberOf module:Collections
27 - * @method
28 - * @see [async.reject]{@link module:Collections.reject}
29 - * @category Collection
30 - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
31 - * @param {Function} iteratee - An async truth test to apply to each item in
32 - * `coll`.
33 - * The should complete with a boolean value as its `result`.
34 - * Invoked with (item, callback).
35 - * @param {Function} [callback] - A callback which is called after all the
36 - * `iteratee` functions have finished. Invoked with (err, results).
37 - * @returns {Promise} a promise, if no callback is passed
38 - */
39 -function rejectSeries(coll, iteratee, callback) {
40 - return (0, _reject3.default)(_eachOfSeries2.default, coll, iteratee, callback);
41 -}
42 -exports.default = (0, _awaitify2.default)(rejectSeries, 3);
43 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -exports.default = retryable;
7 -
8 -var _retry = require('./retry.js');
9 -
10 -var _retry2 = _interopRequireDefault(_retry);
11 -
12 -var _initialParams = require('./internal/initialParams.js');
13 -
14 -var _initialParams2 = _interopRequireDefault(_initialParams);
15 -
16 -var _wrapAsync = require('./internal/wrapAsync.js');
17 -
18 -var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
19 -
20 -var _promiseCallback = require('./internal/promiseCallback.js');
21 -
22 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23 -
24 -/**
25 - * A close relative of [`retry`]{@link module:ControlFlow.retry}. This method
26 - * wraps a task and makes it retryable, rather than immediately calling it
27 - * with retries.
28 - *
29 - * @name retryable
30 - * @static
31 - * @memberOf module:ControlFlow
32 - * @method
33 - * @see [async.retry]{@link module:ControlFlow.retry}
34 - * @category Control Flow
35 - * @param {Object|number} [opts = {times: 5, interval: 0}| 5] - optional
36 - * options, exactly the same as from `retry`, except for a `opts.arity` that
37 - * is the arity of the `task` function, defaulting to `task.length`
38 - * @param {AsyncFunction} task - the asynchronous function to wrap.
39 - * This function will be passed any arguments passed to the returned wrapper.
40 - * Invoked with (...args, callback).
41 - * @returns {AsyncFunction} The wrapped function, which when invoked, will
42 - * retry on an error, based on the parameters specified in `opts`.
43 - * This function will accept the same parameters as `task`.
44 - * @example
45 - *
46 - * async.auto({
47 - * dep1: async.retryable(3, getFromFlakyService),
48 - * process: ["dep1", async.retryable(3, function (results, cb) {
49 - * maybeProcessData(results.dep1, cb);
50 - * })]
51 - * }, callback);
52 - */
53 -function retryable(opts, task) {
54 - if (!task) {
55 - task = opts;
56 - opts = null;
57 - }
58 - let arity = opts && opts.arity || task.length;
59 - if ((0, _wrapAsync.isAsync)(task)) {
60 - arity += 1;
61 - }
62 - var _task = (0, _wrapAsync2.default)(task);
63 - return (0, _initialParams2.default)((args, callback) => {
64 - if (args.length < arity - 1 || callback == null) {
65 - args.push(callback);
66 - callback = (0, _promiseCallback.promiseCallback)();
67 - }
68 - function taskFn(cb) {
69 - _task(...args, cb);
70 - }
71 -
72 - if (opts) (0, _retry2.default)(opts, taskFn, callback);else (0, _retry2.default)(taskFn, callback);
73 -
74 - return callback[_promiseCallback.PROMISE_SYMBOL];
75 - });
76 -}
77 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -
7 -var _filter2 = require('./internal/filter.js');
8 -
9 -var _filter3 = _interopRequireDefault(_filter2);
10 -
11 -var _eachOf = require('./eachOf.js');
12 -
13 -var _eachOf2 = _interopRequireDefault(_eachOf);
14 -
15 -var _awaitify = require('./internal/awaitify.js');
16 -
17 -var _awaitify2 = _interopRequireDefault(_awaitify);
18 -
19 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 -
21 -/**
22 - * Returns a new array of all the values in `coll` which pass an async truth
23 - * test. This operation is performed in parallel, but the results array will be
24 - * in the same order as the original.
25 - *
26 - * @name filter
27 - * @static
28 - * @memberOf module:Collections
29 - * @method
30 - * @alias select
31 - * @category Collection
32 - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
33 - * @param {Function} iteratee - A truth test to apply to each item in `coll`.
34 - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called
35 - * with a boolean argument once it has completed. Invoked with (item, callback).
36 - * @param {Function} [callback] - A callback which is called after all the
37 - * `iteratee` functions have finished. Invoked with (err, results).
38 - * @returns {Promise} a promise, if no callback provided
39 - * @example
40 - *
41 - * // dir1 is a directory that contains file1.txt, file2.txt
42 - * // dir2 is a directory that contains file3.txt, file4.txt
43 - * // dir3 is a directory that contains file5.txt
44 - *
45 - * const files = ['dir1/file1.txt','dir2/file3.txt','dir3/file6.txt'];
46 - *
47 - * // asynchronous function that checks if a file exists
48 - * function fileExists(file, callback) {
49 - * fs.access(file, fs.constants.F_OK, (err) => {
50 - * callback(null, !err);
51 - * });
52 - * }
53 - *
54 - * // Using callbacks
55 - * async.filter(files, fileExists, function(err, results) {
56 - * if(err) {
57 - * console.log(err);
58 - * } else {
59 - * console.log(results);
60 - * // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
61 - * // results is now an array of the existing files
62 - * }
63 - * });
64 - *
65 - * // Using Promises
66 - * async.filter(files, fileExists)
67 - * .then(results => {
68 - * console.log(results);
69 - * // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
70 - * // results is now an array of the existing files
71 - * }).catch(err => {
72 - * console.log(err);
73 - * });
74 - *
75 - * // Using async/await
76 - * async () => {
77 - * try {
78 - * let results = await async.filter(files, fileExists);
79 - * console.log(results);
80 - * // [ 'dir1/file1.txt', 'dir2/file3.txt' ]
81 - * // results is now an array of the existing files
82 - * }
83 - * catch (err) {
84 - * console.log(err);
85 - * }
86 - * }
87 - *
88 - */
89 -function filter(coll, iteratee, callback) {
90 - return (0, _filter3.default)(_eachOf2.default, coll, iteratee, callback);
91 -}
92 -exports.default = (0, _awaitify2.default)(filter, 3);
93 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -
7 -var _filter2 = require('./internal/filter.js');
8 -
9 -var _filter3 = _interopRequireDefault(_filter2);
10 -
11 -var _eachOfLimit = require('./internal/eachOfLimit.js');
12 -
13 -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
14 -
15 -var _awaitify = require('./internal/awaitify.js');
16 -
17 -var _awaitify2 = _interopRequireDefault(_awaitify);
18 -
19 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 -
21 -/**
22 - * The same as [`filter`]{@link module:Collections.filter} but runs a maximum of `limit` async operations at a
23 - * time.
24 - *
25 - * @name filterLimit
26 - * @static
27 - * @memberOf module:Collections
28 - * @method
29 - * @see [async.filter]{@link module:Collections.filter}
30 - * @alias selectLimit
31 - * @category Collection
32 - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
33 - * @param {number} limit - The maximum number of async operations at a time.
34 - * @param {Function} iteratee - A truth test to apply to each item in `coll`.
35 - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called
36 - * with a boolean argument once it has completed. Invoked with (item, callback).
37 - * @param {Function} [callback] - A callback which is called after all the
38 - * `iteratee` functions have finished. Invoked with (err, results).
39 - * @returns {Promise} a promise, if no callback provided
40 - */
41 -function filterLimit(coll, limit, iteratee, callback) {
42 - return (0, _filter3.default)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
43 -}
44 -exports.default = (0, _awaitify2.default)(filterLimit, 4);
45 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -
7 -var _filter2 = require('./internal/filter.js');
8 -
9 -var _filter3 = _interopRequireDefault(_filter2);
10 -
11 -var _eachOfSeries = require('./eachOfSeries.js');
12 -
13 -var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
14 -
15 -var _awaitify = require('./internal/awaitify.js');
16 -
17 -var _awaitify2 = _interopRequireDefault(_awaitify);
18 -
19 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 -
21 -/**
22 - * The same as [`filter`]{@link module:Collections.filter} but runs only a single async operation at a time.
23 - *
24 - * @name filterSeries
25 - * @static
26 - * @memberOf module:Collections
27 - * @method
28 - * @see [async.filter]{@link module:Collections.filter}
29 - * @alias selectSeries
30 - * @category Collection
31 - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 - * @param {Function} iteratee - A truth test to apply to each item in `coll`.
33 - * The `iteratee` is passed a `callback(err, truthValue)`, which must be called
34 - * with a boolean argument once it has completed. Invoked with (item, callback).
35 - * @param {Function} [callback] - A callback which is called after all the
36 - * `iteratee` functions have finished. Invoked with (err, results)
37 - * @returns {Promise} a promise, if no callback provided
38 - */
39 -function filterSeries(coll, iteratee, callback) {
40 - return (0, _filter3.default)(_eachOfSeries2.default, coll, iteratee, callback);
41 -}
42 -exports.default = (0, _awaitify2.default)(filterSeries, 3);
43 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -exports.default = seq;
7 -
8 -var _reduce = require('./reduce.js');
9 -
10 -var _reduce2 = _interopRequireDefault(_reduce);
11 -
12 -var _wrapAsync = require('./internal/wrapAsync.js');
13 -
14 -var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
15 -
16 -var _promiseCallback = require('./internal/promiseCallback.js');
17 -
18 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19 -
20 -/**
21 - * Version of the compose function that is more natural to read. Each function
22 - * consumes the return value of the previous function. It is the equivalent of
23 - * [compose]{@link module:ControlFlow.compose} with the arguments reversed.
24 - *
25 - * Each function is executed with the `this` binding of the composed function.
26 - *
27 - * @name seq
28 - * @static
29 - * @memberOf module:ControlFlow
30 - * @method
31 - * @see [async.compose]{@link module:ControlFlow.compose}
32 - * @category Control Flow
33 - * @param {...AsyncFunction} functions - the asynchronous functions to compose
34 - * @returns {Function} a function that composes the `functions` in order
35 - * @example
36 - *
37 - * // Requires lodash (or underscore), express3 and dresende's orm2.
38 - * // Part of an app, that fetches cats of the logged user.
39 - * // This example uses `seq` function to avoid overnesting and error
40 - * // handling clutter.
41 - * app.get('/cats', function(request, response) {
42 - * var User = request.models.User;
43 - * async.seq(
44 - * User.get.bind(User), // 'User.get' has signature (id, callback(err, data))
45 - * function(user, fn) {
46 - * user.getCats(fn); // 'getCats' has signature (callback(err, data))
47 - * }
48 - * )(req.session.user_id, function (err, cats) {
49 - * if (err) {
50 - * console.error(err);
51 - * response.json({ status: 'error', message: err.message });
52 - * } else {
53 - * response.json({ status: 'ok', message: 'Cats found', data: cats });
54 - * }
55 - * });
56 - * });
57 - */
58 -function seq(...functions) {
59 - var _functions = functions.map(_wrapAsync2.default);
60 - return function (...args) {
61 - var that = this;
62 -
63 - var cb = args[args.length - 1];
64 - if (typeof cb == 'function') {
65 - args.pop();
66 - } else {
67 - cb = (0, _promiseCallback.promiseCallback)();
68 - }
69 -
70 - (0, _reduce2.default)(_functions, args, (newargs, fn, iterCb) => {
71 - fn.apply(that, newargs.concat((err, ...nextargs) => {
72 - iterCb(err, nextargs);
73 - }));
74 - }, (err, results) => cb(err, ...results));
75 -
76 - return cb[_promiseCallback.PROMISE_SYMBOL];
77 - };
78 -}
79 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -
7 -var _setImmediate = require('./internal/setImmediate.js');
8 -
9 -var _setImmediate2 = _interopRequireDefault(_setImmediate);
10 -
11 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
12 -
13 -/**
14 - * Calls `callback` on a later loop around the event loop. In Node.js this just
15 - * calls `setImmediate`. In the browser it will use `setImmediate` if
16 - * available, otherwise `setTimeout(callback, 0)`, which means other higher
17 - * priority events may precede the execution of `callback`.
18 - *
19 - * This is used internally for browser-compatibility purposes.
20 - *
21 - * @name setImmediate
22 - * @static
23 - * @memberOf module:Utils
24 - * @method
25 - * @see [async.nextTick]{@link module:Utils.nextTick}
26 - * @category Util
27 - * @param {Function} callback - The function to call on a later loop around
28 - * the event loop. Invoked with (args...).
29 - * @param {...*} args... - any number of additional arguments to pass to the
30 - * callback on the next tick.
31 - * @example
32 - *
33 - * var call_order = [];
34 - * async.nextTick(function() {
35 - * call_order.push('two');
36 - * // call_order now equals ['one','two']
37 - * });
38 - * call_order.push('one');
39 - *
40 - * async.setImmediate(function (a, b, c) {
41 - * // a, b, and c equal 1, 2, and 3
42 - * }, 1, 2, 3);
43 - */
44 -exports.default = _setImmediate2.default;
45 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -
7 -var _createTester = require('./internal/createTester.js');
8 -
9 -var _createTester2 = _interopRequireDefault(_createTester);
10 -
11 -var _eachOf = require('./eachOf.js');
12 -
13 -var _eachOf2 = _interopRequireDefault(_eachOf);
14 -
15 -var _awaitify = require('./internal/awaitify.js');
16 -
17 -var _awaitify2 = _interopRequireDefault(_awaitify);
18 -
19 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 -
21 -/**
22 - * Returns `true` if at least one element in the `coll` satisfies an async test.
23 - * If any iteratee call returns `true`, the main `callback` is immediately
24 - * called.
25 - *
26 - * @name some
27 - * @static
28 - * @memberOf module:Collections
29 - * @method
30 - * @alias any
31 - * @category Collection
32 - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
33 - * @param {AsyncFunction} iteratee - An async truth test to apply to each item
34 - * in the collections in parallel.
35 - * The iteratee should complete with a boolean `result` value.
36 - * Invoked with (item, callback).
37 - * @param {Function} [callback] - A callback which is called as soon as any
38 - * iteratee returns `true`, or after all the iteratee functions have finished.
39 - * Result will be either `true` or `false` depending on the values of the async
40 - * tests. Invoked with (err, result).
41 - * @returns {Promise} a promise, if no callback provided
42 - * @example
43 - *
44 - * // dir1 is a directory that contains file1.txt, file2.txt
45 - * // dir2 is a directory that contains file3.txt, file4.txt
46 - * // dir3 is a directory that contains file5.txt
47 - * // dir4 does not exist
48 - *
49 - * // asynchronous function that checks if a file exists
50 - * function fileExists(file, callback) {
51 - * fs.access(file, fs.constants.F_OK, (err) => {
52 - * callback(null, !err);
53 - * });
54 - * }
55 - *
56 - * // Using callbacks
57 - * async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists,
58 - * function(err, result) {
59 - * console.log(result);
60 - * // true
61 - * // result is true since some file in the list exists
62 - * }
63 - *);
64 - *
65 - * async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists,
66 - * function(err, result) {
67 - * console.log(result);
68 - * // false
69 - * // result is false since none of the files exists
70 - * }
71 - *);
72 - *
73 - * // Using Promises
74 - * async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists)
75 - * .then( result => {
76 - * console.log(result);
77 - * // true
78 - * // result is true since some file in the list exists
79 - * }).catch( err => {
80 - * console.log(err);
81 - * });
82 - *
83 - * async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists)
84 - * .then( result => {
85 - * console.log(result);
86 - * // false
87 - * // result is false since none of the files exists
88 - * }).catch( err => {
89 - * console.log(err);
90 - * });
91 - *
92 - * // Using async/await
93 - * async () => {
94 - * try {
95 - * let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir3/file5.txt'], fileExists);
96 - * console.log(result);
97 - * // true
98 - * // result is true since some file in the list exists
99 - * }
100 - * catch (err) {
101 - * console.log(err);
102 - * }
103 - * }
104 - *
105 - * async () => {
106 - * try {
107 - * let result = await async.some(['dir1/missing.txt','dir2/missing.txt','dir4/missing.txt'], fileExists);
108 - * console.log(result);
109 - * // false
110 - * // result is false since none of the files exists
111 - * }
112 - * catch (err) {
113 - * console.log(err);
114 - * }
115 - * }
116 - *
117 - */
118 -function some(coll, iteratee, callback) {
119 - return (0, _createTester2.default)(Boolean, res => res)(_eachOf2.default, coll, iteratee, callback);
120 -}
121 -exports.default = (0, _awaitify2.default)(some, 3);
122 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -
7 -var _createTester = require('./internal/createTester.js');
8 -
9 -var _createTester2 = _interopRequireDefault(_createTester);
10 -
11 -var _eachOfLimit = require('./internal/eachOfLimit.js');
12 -
13 -var _eachOfLimit2 = _interopRequireDefault(_eachOfLimit);
14 -
15 -var _awaitify = require('./internal/awaitify.js');
16 -
17 -var _awaitify2 = _interopRequireDefault(_awaitify);
18 -
19 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 -
21 -/**
22 - * The same as [`some`]{@link module:Collections.some} but runs a maximum of `limit` async operations at a time.
23 - *
24 - * @name someLimit
25 - * @static
26 - * @memberOf module:Collections
27 - * @method
28 - * @see [async.some]{@link module:Collections.some}
29 - * @alias anyLimit
30 - * @category Collection
31 - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 - * @param {number} limit - The maximum number of async operations at a time.
33 - * @param {AsyncFunction} iteratee - An async truth test to apply to each item
34 - * in the collections in parallel.
35 - * The iteratee should complete with a boolean `result` value.
36 - * Invoked with (item, callback).
37 - * @param {Function} [callback] - A callback which is called as soon as any
38 - * iteratee returns `true`, or after all the iteratee functions have finished.
39 - * Result will be either `true` or `false` depending on the values of the async
40 - * tests. Invoked with (err, result).
41 - * @returns {Promise} a promise, if no callback provided
42 - */
43 -function someLimit(coll, limit, iteratee, callback) {
44 - return (0, _createTester2.default)(Boolean, res => res)((0, _eachOfLimit2.default)(limit), coll, iteratee, callback);
45 -}
46 -exports.default = (0, _awaitify2.default)(someLimit, 4);
47 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -
7 -var _createTester = require('./internal/createTester.js');
8 -
9 -var _createTester2 = _interopRequireDefault(_createTester);
10 -
11 -var _eachOfSeries = require('./eachOfSeries.js');
12 -
13 -var _eachOfSeries2 = _interopRequireDefault(_eachOfSeries);
14 -
15 -var _awaitify = require('./internal/awaitify.js');
16 -
17 -var _awaitify2 = _interopRequireDefault(_awaitify);
18 -
19 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 -
21 -/**
22 - * The same as [`some`]{@link module:Collections.some} but runs only a single async operation at a time.
23 - *
24 - * @name someSeries
25 - * @static
26 - * @memberOf module:Collections
27 - * @method
28 - * @see [async.some]{@link module:Collections.some}
29 - * @alias anySeries
30 - * @category Collection
31 - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
32 - * @param {AsyncFunction} iteratee - An async truth test to apply to each item
33 - * in the collections in series.
34 - * The iteratee should complete with a boolean `result` value.
35 - * Invoked with (item, callback).
36 - * @param {Function} [callback] - A callback which is called as soon as any
37 - * iteratee returns `true`, or after all the iteratee functions have finished.
38 - * Result will be either `true` or `false` depending on the values of the async
39 - * tests. Invoked with (err, result).
40 - * @returns {Promise} a promise, if no callback provided
41 - */
42 -function someSeries(coll, iteratee, callback) {
43 - return (0, _createTester2.default)(Boolean, res => res)(_eachOfSeries2.default, coll, iteratee, callback);
44 -}
45 -exports.default = (0, _awaitify2.default)(someSeries, 3);
46 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -
7 -var _map = require('./map.js');
8 -
9 -var _map2 = _interopRequireDefault(_map);
10 -
11 -var _wrapAsync = require('./internal/wrapAsync.js');
12 -
13 -var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
14 -
15 -var _awaitify = require('./internal/awaitify.js');
16 -
17 -var _awaitify2 = _interopRequireDefault(_awaitify);
18 -
19 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 -
21 -/**
22 - * Sorts a list by the results of running each `coll` value through an async
23 - * `iteratee`.
24 - *
25 - * @name sortBy
26 - * @static
27 - * @memberOf module:Collections
28 - * @method
29 - * @category Collection
30 - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
31 - * @param {AsyncFunction} iteratee - An async function to apply to each item in
32 - * `coll`.
33 - * The iteratee should complete with a value to use as the sort criteria as
34 - * its `result`.
35 - * Invoked with (item, callback).
36 - * @param {Function} callback - A callback which is called after all the
37 - * `iteratee` functions have finished, or an error occurs. Results is the items
38 - * from the original `coll` sorted by the values returned by the `iteratee`
39 - * calls. Invoked with (err, results).
40 - * @returns {Promise} a promise, if no callback passed
41 - * @example
42 - *
43 - * // bigfile.txt is a file that is 251100 bytes in size
44 - * // mediumfile.txt is a file that is 11000 bytes in size
45 - * // smallfile.txt is a file that is 121 bytes in size
46 - *
47 - * // asynchronous function that returns the file size in bytes
48 - * function getFileSizeInBytes(file, callback) {
49 - * fs.stat(file, function(err, stat) {
50 - * if (err) {
51 - * return callback(err);
52 - * }
53 - * callback(null, stat.size);
54 - * });
55 - * }
56 - *
57 - * // Using callbacks
58 - * async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], getFileSizeInBytes,
59 - * function(err, results) {
60 - * if (err) {
61 - * console.log(err);
62 - * } else {
63 - * console.log(results);
64 - * // results is now the original array of files sorted by
65 - * // file size (ascending by default), e.g.
66 - * // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
67 - * }
68 - * }
69 - * );
70 - *
71 - * // By modifying the callback parameter the
72 - * // sorting order can be influenced:
73 - *
74 - * // ascending order
75 - * async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], function(file, callback) {
76 - * getFileSizeInBytes(file, function(getFileSizeErr, fileSize) {
77 - * if (getFileSizeErr) return callback(getFileSizeErr);
78 - * callback(null, fileSize);
79 - * });
80 - * }, function(err, results) {
81 - * if (err) {
82 - * console.log(err);
83 - * } else {
84 - * console.log(results);
85 - * // results is now the original array of files sorted by
86 - * // file size (ascending by default), e.g.
87 - * // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
88 - * }
89 - * }
90 - * );
91 - *
92 - * // descending order
93 - * async.sortBy(['bigfile.txt','mediumfile.txt','smallfile.txt'], function(file, callback) {
94 - * getFileSizeInBytes(file, function(getFileSizeErr, fileSize) {
95 - * if (getFileSizeErr) {
96 - * return callback(getFileSizeErr);
97 - * }
98 - * callback(null, fileSize * -1);
99 - * });
100 - * }, function(err, results) {
101 - * if (err) {
102 - * console.log(err);
103 - * } else {
104 - * console.log(results);
105 - * // results is now the original array of files sorted by
106 - * // file size (ascending by default), e.g.
107 - * // [ 'bigfile.txt', 'mediumfile.txt', 'smallfile.txt']
108 - * }
109 - * }
110 - * );
111 - *
112 - * // Error handling
113 - * async.sortBy(['mediumfile.txt','smallfile.txt','missingfile.txt'], getFileSizeInBytes,
114 - * function(err, results) {
115 - * if (err) {
116 - * console.log(err);
117 - * // [ Error: ENOENT: no such file or directory ]
118 - * } else {
119 - * console.log(results);
120 - * }
121 - * }
122 - * );
123 - *
124 - * // Using Promises
125 - * async.sortBy(['mediumfile.txt','smallfile.txt','bigfile.txt'], getFileSizeInBytes)
126 - * .then( results => {
127 - * console.log(results);
128 - * // results is now the original array of files sorted by
129 - * // file size (ascending by default), e.g.
130 - * // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
131 - * }).catch( err => {
132 - * console.log(err);
133 - * });
134 - *
135 - * // Error handling
136 - * async.sortBy(['mediumfile.txt','smallfile.txt','missingfile.txt'], getFileSizeInBytes)
137 - * .then( results => {
138 - * console.log(results);
139 - * }).catch( err => {
140 - * console.log(err);
141 - * // [ Error: ENOENT: no such file or directory ]
142 - * });
143 - *
144 - * // Using async/await
145 - * (async () => {
146 - * try {
147 - * let results = await async.sortBy(['bigfile.txt','mediumfile.txt','smallfile.txt'], getFileSizeInBytes);
148 - * console.log(results);
149 - * // results is now the original array of files sorted by
150 - * // file size (ascending by default), e.g.
151 - * // [ 'smallfile.txt', 'mediumfile.txt', 'bigfile.txt']
152 - * }
153 - * catch (err) {
154 - * console.log(err);
155 - * }
156 - * })();
157 - *
158 - * // Error handling
159 - * async () => {
160 - * try {
161 - * let results = await async.sortBy(['missingfile.txt','mediumfile.txt','smallfile.txt'], getFileSizeInBytes);
162 - * console.log(results);
163 - * }
164 - * catch (err) {
165 - * console.log(err);
166 - * // [ Error: ENOENT: no such file or directory ]
167 - * }
168 - * }
169 - *
170 - */
171 -function sortBy(coll, iteratee, callback) {
172 - var _iteratee = (0, _wrapAsync2.default)(iteratee);
173 - return (0, _map2.default)(coll, (x, iterCb) => {
174 - _iteratee(x, (err, criteria) => {
175 - if (err) return iterCb(err);
176 - iterCb(err, { value: x, criteria });
177 - });
178 - }, (err, results) => {
179 - if (err) return callback(err);
180 - callback(null, results.sort(comparator).map(v => v.value));
181 - });
182 -
183 - function comparator(left, right) {
184 - var a = left.criteria,
185 - b = right.criteria;
186 - return a < b ? -1 : a > b ? 1 : 0;
187 - }
188 -}
189 -exports.default = (0, _awaitify2.default)(sortBy, 3);
190 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -exports.default = timeout;
7 -
8 -var _initialParams = require('./internal/initialParams.js');
9 -
10 -var _initialParams2 = _interopRequireDefault(_initialParams);
11 -
12 -var _wrapAsync = require('./internal/wrapAsync.js');
13 -
14 -var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
15 -
16 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17 -
18 -/**
19 - * Sets a time limit on an asynchronous function. If the function does not call
20 - * its callback within the specified milliseconds, it will be called with a
21 - * timeout error. The code property for the error object will be `'ETIMEDOUT'`.
22 - *
23 - * @name timeout
24 - * @static
25 - * @memberOf module:Utils
26 - * @method
27 - * @category Util
28 - * @param {AsyncFunction} asyncFn - The async function to limit in time.
29 - * @param {number} milliseconds - The specified time limit.
30 - * @param {*} [info] - Any variable you want attached (`string`, `object`, etc)
31 - * to timeout Error for more information..
32 - * @returns {AsyncFunction} Returns a wrapped function that can be used with any
33 - * of the control flow functions.
34 - * Invoke this function with the same parameters as you would `asyncFunc`.
35 - * @example
36 - *
37 - * function myFunction(foo, callback) {
38 - * doAsyncTask(foo, function(err, data) {
39 - * // handle errors
40 - * if (err) return callback(err);
41 - *
42 - * // do some stuff ...
43 - *
44 - * // return processed data
45 - * return callback(null, data);
46 - * });
47 - * }
48 - *
49 - * var wrapped = async.timeout(myFunction, 1000);
50 - *
51 - * // call `wrapped` as you would `myFunction`
52 - * wrapped({ bar: 'bar' }, function(err, data) {
53 - * // if `myFunction` takes < 1000 ms to execute, `err`
54 - * // and `data` will have their expected values
55 - *
56 - * // else `err` will be an Error with the code 'ETIMEDOUT'
57 - * });
58 - */
59 -function timeout(asyncFn, milliseconds, info) {
60 - var fn = (0, _wrapAsync2.default)(asyncFn);
61 -
62 - return (0, _initialParams2.default)((args, callback) => {
63 - var timedOut = false;
64 - var timer;
65 -
66 - function timeoutCallback() {
67 - var name = asyncFn.name || 'anonymous';
68 - var error = new Error('Callback function "' + name + '" timed out.');
69 - error.code = 'ETIMEDOUT';
70 - if (info) {
71 - error.info = info;
72 - }
73 - timedOut = true;
74 - callback(error);
75 - }
76 -
77 - args.push((...cbArgs) => {
78 - if (!timedOut) {
79 - callback(...cbArgs);
80 - clearTimeout(timer);
81 - }
82 - });
83 -
84 - // setup timer and call original function
85 - timer = setTimeout(timeoutCallback, milliseconds);
86 - fn(...args);
87 - });
88 -}
89 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -exports.default = times;
7 -
8 -var _timesLimit = require('./timesLimit.js');
9 -
10 -var _timesLimit2 = _interopRequireDefault(_timesLimit);
11 -
12 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13 -
14 -/**
15 - * Calls the `iteratee` function `n` times, and accumulates results in the same
16 - * manner you would use with [map]{@link module:Collections.map}.
17 - *
18 - * @name times
19 - * @static
20 - * @memberOf module:ControlFlow
21 - * @method
22 - * @see [async.map]{@link module:Collections.map}
23 - * @category Control Flow
24 - * @param {number} n - The number of times to run the function.
25 - * @param {AsyncFunction} iteratee - The async function to call `n` times.
26 - * Invoked with the iteration index and a callback: (n, next).
27 - * @param {Function} callback - see {@link module:Collections.map}.
28 - * @returns {Promise} a promise, if no callback is provided
29 - * @example
30 - *
31 - * // Pretend this is some complicated async factory
32 - * var createUser = function(id, callback) {
33 - * callback(null, {
34 - * id: 'user' + id
35 - * });
36 - * };
37 - *
38 - * // generate 5 users
39 - * async.times(5, function(n, next) {
40 - * createUser(n, function(err, user) {
41 - * next(err, user);
42 - * });
43 - * }, function(err, users) {
44 - * // we should now have 5 users
45 - * });
46 - */
47 -function times(n, iteratee, callback) {
48 - return (0, _timesLimit2.default)(n, Infinity, iteratee, callback);
49 -}
50 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -exports.default = timesLimit;
7 -
8 -var _mapLimit = require('./mapLimit.js');
9 -
10 -var _mapLimit2 = _interopRequireDefault(_mapLimit);
11 -
12 -var _range = require('./internal/range.js');
13 -
14 -var _range2 = _interopRequireDefault(_range);
15 -
16 -var _wrapAsync = require('./internal/wrapAsync.js');
17 -
18 -var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
19 -
20 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21 -
22 -/**
23 - * The same as [times]{@link module:ControlFlow.times} but runs a maximum of `limit` async operations at a
24 - * time.
25 - *
26 - * @name timesLimit
27 - * @static
28 - * @memberOf module:ControlFlow
29 - * @method
30 - * @see [async.times]{@link module:ControlFlow.times}
31 - * @category Control Flow
32 - * @param {number} count - The number of times to run the function.
33 - * @param {number} limit - The maximum number of async operations at a time.
34 - * @param {AsyncFunction} iteratee - The async function to call `n` times.
35 - * Invoked with the iteration index and a callback: (n, next).
36 - * @param {Function} callback - see [async.map]{@link module:Collections.map}.
37 - * @returns {Promise} a promise, if no callback is provided
38 - */
39 -function timesLimit(count, limit, iteratee, callback) {
40 - var _iteratee = (0, _wrapAsync2.default)(iteratee);
41 - return (0, _mapLimit2.default)((0, _range2.default)(count), limit, _iteratee, callback);
42 -}
43 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -exports.default = timesSeries;
7 -
8 -var _timesLimit = require('./timesLimit.js');
9 -
10 -var _timesLimit2 = _interopRequireDefault(_timesLimit);
11 -
12 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13 -
14 -/**
15 - * The same as [times]{@link module:ControlFlow.times} but runs only a single async operation at a time.
16 - *
17 - * @name timesSeries
18 - * @static
19 - * @memberOf module:ControlFlow
20 - * @method
21 - * @see [async.times]{@link module:ControlFlow.times}
22 - * @category Control Flow
23 - * @param {number} n - The number of times to run the function.
24 - * @param {AsyncFunction} iteratee - The async function to call `n` times.
25 - * Invoked with the iteration index and a callback: (n, next).
26 - * @param {Function} callback - see {@link module:Collections.map}.
27 - * @returns {Promise} a promise, if no callback is provided
28 - */
29 -function timesSeries(n, iteratee, callback) {
30 - return (0, _timesLimit2.default)(n, 1, iteratee, callback);
31 -}
32 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -exports.default = transform;
7 -
8 -var _eachOf = require('./eachOf.js');
9 -
10 -var _eachOf2 = _interopRequireDefault(_eachOf);
11 -
12 -var _once = require('./internal/once.js');
13 -
14 -var _once2 = _interopRequireDefault(_once);
15 -
16 -var _wrapAsync = require('./internal/wrapAsync.js');
17 -
18 -var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
19 -
20 -var _promiseCallback = require('./internal/promiseCallback.js');
21 -
22 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
23 -
24 -/**
25 - * A relative of `reduce`. Takes an Object or Array, and iterates over each
26 - * element in parallel, each step potentially mutating an `accumulator` value.
27 - * The type of the accumulator defaults to the type of collection passed in.
28 - *
29 - * @name transform
30 - * @static
31 - * @memberOf module:Collections
32 - * @method
33 - * @category Collection
34 - * @param {Array|Iterable|AsyncIterable|Object} coll - A collection to iterate over.
35 - * @param {*} [accumulator] - The initial state of the transform. If omitted,
36 - * it will default to an empty Object or Array, depending on the type of `coll`
37 - * @param {AsyncFunction} iteratee - A function applied to each item in the
38 - * collection that potentially modifies the accumulator.
39 - * Invoked with (accumulator, item, key, callback).
40 - * @param {Function} [callback] - A callback which is called after all the
41 - * `iteratee` functions have finished. Result is the transformed accumulator.
42 - * Invoked with (err, result).
43 - * @returns {Promise} a promise, if no callback provided
44 - * @example
45 - *
46 - * // file1.txt is a file that is 1000 bytes in size
47 - * // file2.txt is a file that is 2000 bytes in size
48 - * // file3.txt is a file that is 3000 bytes in size
49 - *
50 - * // helper function that returns human-readable size format from bytes
51 - * function formatBytes(bytes, decimals = 2) {
52 - * // implementation not included for brevity
53 - * return humanReadbleFilesize;
54 - * }
55 - *
56 - * const fileList = ['file1.txt','file2.txt','file3.txt'];
57 - *
58 - * // asynchronous function that returns the file size, transformed to human-readable format
59 - * // e.g. 1024 bytes = 1KB, 1234 bytes = 1.21 KB, 1048576 bytes = 1MB, etc.
60 - * function transformFileSize(acc, value, key, callback) {
61 - * fs.stat(value, function(err, stat) {
62 - * if (err) {
63 - * return callback(err);
64 - * }
65 - * acc[key] = formatBytes(stat.size);
66 - * callback(null);
67 - * });
68 - * }
69 - *
70 - * // Using callbacks
71 - * async.transform(fileList, transformFileSize, function(err, result) {
72 - * if(err) {
73 - * console.log(err);
74 - * } else {
75 - * console.log(result);
76 - * // [ '1000 Bytes', '1.95 KB', '2.93 KB' ]
77 - * }
78 - * });
79 - *
80 - * // Using Promises
81 - * async.transform(fileList, transformFileSize)
82 - * .then(result => {
83 - * console.log(result);
84 - * // [ '1000 Bytes', '1.95 KB', '2.93 KB' ]
85 - * }).catch(err => {
86 - * console.log(err);
87 - * });
88 - *
89 - * // Using async/await
90 - * (async () => {
91 - * try {
92 - * let result = await async.transform(fileList, transformFileSize);
93 - * console.log(result);
94 - * // [ '1000 Bytes', '1.95 KB', '2.93 KB' ]
95 - * }
96 - * catch (err) {
97 - * console.log(err);
98 - * }
99 - * })();
100 - *
101 - * @example
102 - *
103 - * // file1.txt is a file that is 1000 bytes in size
104 - * // file2.txt is a file that is 2000 bytes in size
105 - * // file3.txt is a file that is 3000 bytes in size
106 - *
107 - * // helper function that returns human-readable size format from bytes
108 - * function formatBytes(bytes, decimals = 2) {
109 - * // implementation not included for brevity
110 - * return humanReadbleFilesize;
111 - * }
112 - *
113 - * const fileMap = { f1: 'file1.txt', f2: 'file2.txt', f3: 'file3.txt' };
114 - *
115 - * // asynchronous function that returns the file size, transformed to human-readable format
116 - * // e.g. 1024 bytes = 1KB, 1234 bytes = 1.21 KB, 1048576 bytes = 1MB, etc.
117 - * function transformFileSize(acc, value, key, callback) {
118 - * fs.stat(value, function(err, stat) {
119 - * if (err) {
120 - * return callback(err);
121 - * }
122 - * acc[key] = formatBytes(stat.size);
123 - * callback(null);
124 - * });
125 - * }
126 - *
127 - * // Using callbacks
128 - * async.transform(fileMap, transformFileSize, function(err, result) {
129 - * if(err) {
130 - * console.log(err);
131 - * } else {
132 - * console.log(result);
133 - * // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' }
134 - * }
135 - * });
136 - *
137 - * // Using Promises
138 - * async.transform(fileMap, transformFileSize)
139 - * .then(result => {
140 - * console.log(result);
141 - * // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' }
142 - * }).catch(err => {
143 - * console.log(err);
144 - * });
145 - *
146 - * // Using async/await
147 - * async () => {
148 - * try {
149 - * let result = await async.transform(fileMap, transformFileSize);
150 - * console.log(result);
151 - * // { f1: '1000 Bytes', f2: '1.95 KB', f3: '2.93 KB' }
152 - * }
153 - * catch (err) {
154 - * console.log(err);
155 - * }
156 - * }
157 - *
158 - */
159 -function transform(coll, accumulator, iteratee, callback) {
160 - if (arguments.length <= 3 && typeof accumulator === 'function') {
161 - callback = iteratee;
162 - iteratee = accumulator;
163 - accumulator = Array.isArray(coll) ? [] : {};
164 - }
165 - callback = (0, _once2.default)(callback || (0, _promiseCallback.promiseCallback)());
166 - var _iteratee = (0, _wrapAsync2.default)(iteratee);
167 -
168 - (0, _eachOf2.default)(coll, (v, k, cb) => {
169 - _iteratee(accumulator, v, k, cb);
170 - }, err => callback(err, accumulator));
171 - return callback[_promiseCallback.PROMISE_SYMBOL];
172 -}
173 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -
7 -var _eachSeries = require('./eachSeries.js');
8 -
9 -var _eachSeries2 = _interopRequireDefault(_eachSeries);
10 -
11 -var _wrapAsync = require('./internal/wrapAsync.js');
12 -
13 -var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
14 -
15 -var _awaitify = require('./internal/awaitify.js');
16 -
17 -var _awaitify2 = _interopRequireDefault(_awaitify);
18 -
19 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 -
21 -/**
22 - * It runs each task in series but stops whenever any of the functions were
23 - * successful. If one of the tasks were successful, the `callback` will be
24 - * passed the result of the successful task. If all tasks fail, the callback
25 - * will be passed the error and result (if any) of the final attempt.
26 - *
27 - * @name tryEach
28 - * @static
29 - * @memberOf module:ControlFlow
30 - * @method
31 - * @category Control Flow
32 - * @param {Array|Iterable|AsyncIterable|Object} tasks - A collection containing functions to
33 - * run, each function is passed a `callback(err, result)` it must call on
34 - * completion with an error `err` (which can be `null`) and an optional `result`
35 - * value.
36 - * @param {Function} [callback] - An optional callback which is called when one
37 - * of the tasks has succeeded, or all have failed. It receives the `err` and
38 - * `result` arguments of the last attempt at completing the `task`. Invoked with
39 - * (err, results).
40 - * @returns {Promise} a promise, if no callback is passed
41 - * @example
42 - * async.tryEach([
43 - * function getDataFromFirstWebsite(callback) {
44 - * // Try getting the data from the first website
45 - * callback(err, data);
46 - * },
47 - * function getDataFromSecondWebsite(callback) {
48 - * // First website failed,
49 - * // Try getting the data from the backup website
50 - * callback(err, data);
51 - * }
52 - * ],
53 - * // optional callback
54 - * function(err, results) {
55 - * Now do something with the data.
56 - * });
57 - *
58 - */
59 -function tryEach(tasks, callback) {
60 - var error = null;
61 - var result;
62 - return (0, _eachSeries2.default)(tasks, (task, taskCb) => {
63 - (0, _wrapAsync2.default)(task)((err, ...args) => {
64 - if (err === false) return taskCb(err);
65 -
66 - if (args.length < 2) {
67 - [result] = args;
68 - } else {
69 - result = args;
70 - }
71 - error = err;
72 - taskCb(err ? null : {});
73 - });
74 - }, () => callback(error, result));
75 -}
76 -
77 -exports.default = (0, _awaitify2.default)(tryEach);
78 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -"use strict";
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -exports.default = unmemoize;
7 -/**
8 - * Undoes a [memoize]{@link module:Utils.memoize}d function, reverting it to the original,
9 - * unmemoized form. Handy for testing.
10 - *
11 - * @name unmemoize
12 - * @static
13 - * @memberOf module:Utils
14 - * @method
15 - * @see [async.memoize]{@link module:Utils.memoize}
16 - * @category Util
17 - * @param {AsyncFunction} fn - the memoized function
18 - * @returns {AsyncFunction} a function that calls the original unmemoized function
19 - */
20 -function unmemoize(fn) {
21 - return (...args) => {
22 - return (fn.unmemoized || fn)(...args);
23 - };
24 -}
25 -module.exports = exports["default"];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -exports.default = until;
7 -
8 -var _whilst = require('./whilst.js');
9 -
10 -var _whilst2 = _interopRequireDefault(_whilst);
11 -
12 -var _wrapAsync = require('./internal/wrapAsync.js');
13 -
14 -var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
15 -
16 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
17 -
18 -/**
19 - * Repeatedly call `iteratee` until `test` returns `true`. Calls `callback` when
20 - * stopped, or an error occurs. `callback` will be passed an error and any
21 - * arguments passed to the final `iteratee`'s callback.
22 - *
23 - * The inverse of [whilst]{@link module:ControlFlow.whilst}.
24 - *
25 - * @name until
26 - * @static
27 - * @memberOf module:ControlFlow
28 - * @method
29 - * @see [async.whilst]{@link module:ControlFlow.whilst}
30 - * @category Control Flow
31 - * @param {AsyncFunction} test - asynchronous truth test to perform before each
32 - * execution of `iteratee`. Invoked with (callback).
33 - * @param {AsyncFunction} iteratee - An async function which is called each time
34 - * `test` fails. Invoked with (callback).
35 - * @param {Function} [callback] - A callback which is called after the test
36 - * function has passed and repeated execution of `iteratee` has stopped. `callback`
37 - * will be passed an error and any arguments passed to the final `iteratee`'s
38 - * callback. Invoked with (err, [results]);
39 - * @returns {Promise} a promise, if a callback is not passed
40 - *
41 - * @example
42 - * const results = []
43 - * let finished = false
44 - * async.until(function test(cb) {
45 - * cb(null, finished)
46 - * }, function iter(next) {
47 - * fetchPage(url, (err, body) => {
48 - * if (err) return next(err)
49 - * results = results.concat(body.objects)
50 - * finished = !!body.next
51 - * next(err)
52 - * })
53 - * }, function done (err) {
54 - * // all pages have been fetched
55 - * })
56 - */
57 -function until(test, iteratee, callback) {
58 - const _test = (0, _wrapAsync2.default)(test);
59 - return (0, _whilst2.default)(cb => _test((err, truth) => cb(err, !truth)), iteratee, callback);
60 -}
61 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -
7 -var _once = require('./internal/once.js');
8 -
9 -var _once2 = _interopRequireDefault(_once);
10 -
11 -var _onlyOnce = require('./internal/onlyOnce.js');
12 -
13 -var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
14 -
15 -var _wrapAsync = require('./internal/wrapAsync.js');
16 -
17 -var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
18 -
19 -var _awaitify = require('./internal/awaitify.js');
20 -
21 -var _awaitify2 = _interopRequireDefault(_awaitify);
22 -
23 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24 -
25 -/**
26 - * Runs the `tasks` array of functions in series, each passing their results to
27 - * the next in the array. However, if any of the `tasks` pass an error to their
28 - * own callback, the next function is not executed, and the main `callback` is
29 - * immediately called with the error.
30 - *
31 - * @name waterfall
32 - * @static
33 - * @memberOf module:ControlFlow
34 - * @method
35 - * @category Control Flow
36 - * @param {Array} tasks - An array of [async functions]{@link AsyncFunction}
37 - * to run.
38 - * Each function should complete with any number of `result` values.
39 - * The `result` values will be passed as arguments, in order, to the next task.
40 - * @param {Function} [callback] - An optional callback to run once all the
41 - * functions have completed. This will be passed the results of the last task's
42 - * callback. Invoked with (err, [results]).
43 - * @returns undefined
44 - * @example
45 - *
46 - * async.waterfall([
47 - * function(callback) {
48 - * callback(null, 'one', 'two');
49 - * },
50 - * function(arg1, arg2, callback) {
51 - * // arg1 now equals 'one' and arg2 now equals 'two'
52 - * callback(null, 'three');
53 - * },
54 - * function(arg1, callback) {
55 - * // arg1 now equals 'three'
56 - * callback(null, 'done');
57 - * }
58 - * ], function (err, result) {
59 - * // result now equals 'done'
60 - * });
61 - *
62 - * // Or, with named functions:
63 - * async.waterfall([
64 - * myFirstFunction,
65 - * mySecondFunction,
66 - * myLastFunction,
67 - * ], function (err, result) {
68 - * // result now equals 'done'
69 - * });
70 - * function myFirstFunction(callback) {
71 - * callback(null, 'one', 'two');
72 - * }
73 - * function mySecondFunction(arg1, arg2, callback) {
74 - * // arg1 now equals 'one' and arg2 now equals 'two'
75 - * callback(null, 'three');
76 - * }
77 - * function myLastFunction(arg1, callback) {
78 - * // arg1 now equals 'three'
79 - * callback(null, 'done');
80 - * }
81 - */
82 -function waterfall(tasks, callback) {
83 - callback = (0, _once2.default)(callback);
84 - if (!Array.isArray(tasks)) return callback(new Error('First argument to waterfall must be an array of functions'));
85 - if (!tasks.length) return callback();
86 - var taskIndex = 0;
87 -
88 - function nextTask(args) {
89 - var task = (0, _wrapAsync2.default)(tasks[taskIndex++]);
90 - task(...args, (0, _onlyOnce2.default)(next));
91 - }
92 -
93 - function next(err, ...args) {
94 - if (err === false) return;
95 - if (err || taskIndex === tasks.length) {
96 - return callback(err, ...args);
97 - }
98 - nextTask(args);
99 - }
100 -
101 - nextTask([]);
102 -}
103 -
104 -exports.default = (0, _awaitify2.default)(waterfall);
105 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -
7 -var _onlyOnce = require('./internal/onlyOnce.js');
8 -
9 -var _onlyOnce2 = _interopRequireDefault(_onlyOnce);
10 -
11 -var _wrapAsync = require('./internal/wrapAsync.js');
12 -
13 -var _wrapAsync2 = _interopRequireDefault(_wrapAsync);
14 -
15 -var _awaitify = require('./internal/awaitify.js');
16 -
17 -var _awaitify2 = _interopRequireDefault(_awaitify);
18 -
19 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
20 -
21 -/**
22 - * Repeatedly call `iteratee`, while `test` returns `true`. Calls `callback` when
23 - * stopped, or an error occurs.
24 - *
25 - * @name whilst
26 - * @static
27 - * @memberOf module:ControlFlow
28 - * @method
29 - * @category Control Flow
30 - * @param {AsyncFunction} test - asynchronous truth test to perform before each
31 - * execution of `iteratee`. Invoked with ().
32 - * @param {AsyncFunction} iteratee - An async function which is called each time
33 - * `test` passes. Invoked with (callback).
34 - * @param {Function} [callback] - A callback which is called after the test
35 - * function has failed and repeated execution of `iteratee` has stopped. `callback`
36 - * will be passed an error and any arguments passed to the final `iteratee`'s
37 - * callback. Invoked with (err, [results]);
38 - * @returns {Promise} a promise, if no callback is passed
39 - * @example
40 - *
41 - * var count = 0;
42 - * async.whilst(
43 - * function test(cb) { cb(null, count < 5); },
44 - * function iter(callback) {
45 - * count++;
46 - * setTimeout(function() {
47 - * callback(null, count);
48 - * }, 1000);
49 - * },
50 - * function (err, n) {
51 - * // 5 seconds have passed, n = 5
52 - * }
53 - * );
54 - */
55 -function whilst(test, iteratee, callback) {
56 - callback = (0, _onlyOnce2.default)(callback);
57 - var _fn = (0, _wrapAsync2.default)(iteratee);
58 - var _test = (0, _wrapAsync2.default)(test);
59 - var results = [];
60 -
61 - function next(err, ...rest) {
62 - if (err) return callback(err);
63 - results = rest;
64 - if (err === false) return;
65 - _test(check);
66 - }
67 -
68 - function check(err, truth) {
69 - if (err) return callback(err);
70 - if (err === false) return;
71 - if (!truth) return callback(null, ...results);
72 - _fn(next);
73 - }
74 -
75 - return _test(check);
76 -}
77 -exports.default = (0, _awaitify2.default)(whilst, 3);
78 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -'use strict';
2 -
3 -Object.defineProperty(exports, "__esModule", {
4 - value: true
5 -});
6 -exports.default = asyncify;
7 -
8 -var _initialParams = require('./internal/initialParams.js');
9 -
10 -var _initialParams2 = _interopRequireDefault(_initialParams);
11 -
12 -var _setImmediate = require('./internal/setImmediate.js');
13 -
14 -var _setImmediate2 = _interopRequireDefault(_setImmediate);
15 -
16 -var _wrapAsync = require('./internal/wrapAsync.js');
17 -
18 -function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19 -
20 -/**
21 - * Take a sync function and make it async, passing its return value to a
22 - * callback. This is useful for plugging sync functions into a waterfall,
23 - * series, or other async functions. Any arguments passed to the generated
24 - * function will be passed to the wrapped function (except for the final
25 - * callback argument). Errors thrown will be passed to the callback.
26 - *
27 - * If the function passed to `asyncify` returns a Promise, that promises's
28 - * resolved/rejected state will be used to call the callback, rather than simply
29 - * the synchronous return value.
30 - *
31 - * This also means you can asyncify ES2017 `async` functions.
32 - *
33 - * @name asyncify
34 - * @static
35 - * @memberOf module:Utils
36 - * @method
37 - * @alias wrapSync
38 - * @category Util
39 - * @param {Function} func - The synchronous function, or Promise-returning
40 - * function to convert to an {@link AsyncFunction}.
41 - * @returns {AsyncFunction} An asynchronous wrapper of the `func`. To be
42 - * invoked with `(args..., callback)`.
43 - * @example
44 - *
45 - * // passing a regular synchronous function
46 - * async.waterfall([
47 - * async.apply(fs.readFile, filename, "utf8"),
48 - * async.asyncify(JSON.parse),
49 - * function (data, next) {
50 - * // data is the result of parsing the text.
51 - * // If there was a parsing error, it would have been caught.
52 - * }
53 - * ], callback);
54 - *
55 - * // passing a function returning a promise
56 - * async.waterfall([
57 - * async.apply(fs.readFile, filename, "utf8"),
58 - * async.asyncify(function (contents) {
59 - * return db.model.create(contents);
60 - * }),
61 - * function (model, next) {
62 - * // `model` is the instantiated model object.
63 - * // If there was an error, this function would be skipped.
64 - * }
65 - * ], callback);
66 - *
67 - * // es2017 example, though `asyncify` is not needed if your JS environment
68 - * // supports async functions out of the box
69 - * var q = async.queue(async.asyncify(async function(file) {
70 - * var intermediateStep = await processFile(file);
71 - * return await somePromise(intermediateStep)
72 - * }));
73 - *
74 - * q.push(files);
75 - */
76 -function asyncify(func) {
77 - if ((0, _wrapAsync.isAsync)(func)) {
78 - return function (...args /*, callback*/) {
79 - const callback = args.pop();
80 - const promise = func.apply(this, args);
81 - return handlePromise(promise, callback);
82 - };
83 - }
84 -
85 - return (0, _initialParams2.default)(function (args, callback) {
86 - var result;
87 - try {
88 - result = func.apply(this, args);
89 - } catch (e) {
90 - return callback(e);
91 - }
92 - // if result is Promise object
93 - if (result && typeof result.then === 'function') {
94 - return handlePromise(result, callback);
95 - } else {
96 - callback(null, result);
97 - }
98 - });
99 -}
100 -
101 -function handlePromise(promise, callback) {
102 - return promise.then(value => {
103 - invokeCallback(callback, null, value);
104 - }, err => {
105 - invokeCallback(callback, err && err.message ? err : new Error(err));
106 - });
107 -}
108 -
109 -function invokeCallback(callback, error, value) {
110 - try {
111 - callback(error, value);
112 - } catch (err) {
113 - (0, _setImmediate2.default)(e => {
114 - throw e;
115 - }, err);
116 - }
117 -}
118 -module.exports = exports['default'];
...\ No newline at end of file ...\ No newline at end of file
1 -The MIT License (MIT)
2 -
3 -Copyright (c) 2016 Alex Indigo
4 -
5 -Permission is hereby granted, free of charge, to any person obtaining a copy
6 -of this software and associated documentation files (the "Software"), to deal
7 -in the Software without restriction, including without limitation the rights
8 -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 -copies of the Software, and to permit persons to whom the Software is
10 -furnished to do so, subject to the following conditions:
11 -
12 -The above copyright notice and this permission notice shall be included in all
13 -copies or substantial portions of the Software.
14 -
15 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 -SOFTWARE.
1 -# asynckit [![NPM Module](https://img.shields.io/npm/v/asynckit.svg?style=flat)](https://www.npmjs.com/package/asynckit)
2 -
3 -Minimal async jobs utility library, with streams support.
4 -
5 -[![PhantomJS Build](https://img.shields.io/travis/alexindigo/asynckit/v0.4.0.svg?label=browser&style=flat)](https://travis-ci.org/alexindigo/asynckit)
6 -[![Linux Build](https://img.shields.io/travis/alexindigo/asynckit/v0.4.0.svg?label=linux:0.12-6.x&style=flat)](https://travis-ci.org/alexindigo/asynckit)
7 -[![Windows Build](https://img.shields.io/appveyor/ci/alexindigo/asynckit/v0.4.0.svg?label=windows:0.12-6.x&style=flat)](https://ci.appveyor.com/project/alexindigo/asynckit)
8 -
9 -[![Coverage Status](https://img.shields.io/coveralls/alexindigo/asynckit/v0.4.0.svg?label=code+coverage&style=flat)](https://coveralls.io/github/alexindigo/asynckit?branch=master)
10 -[![Dependency Status](https://img.shields.io/david/alexindigo/asynckit/v0.4.0.svg?style=flat)](https://david-dm.org/alexindigo/asynckit)
11 -[![bitHound Overall Score](https://www.bithound.io/github/alexindigo/asynckit/badges/score.svg)](https://www.bithound.io/github/alexindigo/asynckit)
12 -
13 -<!-- [![Readme](https://img.shields.io/badge/readme-tested-brightgreen.svg?style=flat)](https://www.npmjs.com/package/reamde) -->
14 -
15 -AsyncKit provides harness for `parallel` and `serial` iterators over list of items represented by arrays or objects.
16 -Optionally it accepts abort function (should be synchronously return by iterator for each item), and terminates left over jobs upon an error event. For specific iteration order built-in (`ascending` and `descending`) and custom sort helpers also supported, via `asynckit.serialOrdered` method.
17 -
18 -It ensures async operations to keep behavior more stable and prevent `Maximum call stack size exceeded` errors, from sync iterators.
19 -
20 -| compression | size |
21 -| :----------------- | -------: |
22 -| asynckit.js | 12.34 kB |
23 -| asynckit.min.js | 4.11 kB |
24 -| asynckit.min.js.gz | 1.47 kB |
25 -
26 -
27 -## Install
28 -
29 -```sh
30 -$ npm install --save asynckit
31 -```
32 -
33 -## Examples
34 -
35 -### Parallel Jobs
36 -
37 -Runs iterator over provided array in parallel. Stores output in the `result` array,
38 -on the matching positions. In unlikely event of an error from one of the jobs,
39 -will terminate rest of the active jobs (if abort function is provided)
40 -and return error along with salvaged data to the main callback function.
41 -
42 -#### Input Array
43 -
44 -```javascript
45 -var parallel = require('asynckit').parallel
46 - , assert = require('assert')
47 - ;
48 -
49 -var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ]
50 - , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ]
51 - , expectedTarget = [ 1, 1, 2, 4, 8, 16, 32, 64 ]
52 - , target = []
53 - ;
54 -
55 -parallel(source, asyncJob, function(err, result)
56 -{
57 - assert.deepEqual(result, expectedResult);
58 - assert.deepEqual(target, expectedTarget);
59 -});
60 -
61 -// async job accepts one element from the array
62 -// and a callback function
63 -function asyncJob(item, cb)
64 -{
65 - // different delays (in ms) per item
66 - var delay = item * 25;
67 -
68 - // pretend different jobs take different time to finish
69 - // and not in consequential order
70 - var timeoutId = setTimeout(function() {
71 - target.push(item);
72 - cb(null, item * 2);
73 - }, delay);
74 -
75 - // allow to cancel "leftover" jobs upon error
76 - // return function, invoking of which will abort this job
77 - return clearTimeout.bind(null, timeoutId);
78 -}
79 -```
80 -
81 -More examples could be found in [test/test-parallel-array.js](test/test-parallel-array.js).
82 -
83 -#### Input Object
84 -
85 -Also it supports named jobs, listed via object.
86 -
87 -```javascript
88 -var parallel = require('asynckit/parallel')
89 - , assert = require('assert')
90 - ;
91 -
92 -var source = { first: 1, one: 1, four: 4, sixteen: 16, sixtyFour: 64, thirtyTwo: 32, eight: 8, two: 2 }
93 - , expectedResult = { first: 2, one: 2, four: 8, sixteen: 32, sixtyFour: 128, thirtyTwo: 64, eight: 16, two: 4 }
94 - , expectedTarget = [ 1, 1, 2, 4, 8, 16, 32, 64 ]
95 - , expectedKeys = [ 'first', 'one', 'two', 'four', 'eight', 'sixteen', 'thirtyTwo', 'sixtyFour' ]
96 - , target = []
97 - , keys = []
98 - ;
99 -
100 -parallel(source, asyncJob, function(err, result)
101 -{
102 - assert.deepEqual(result, expectedResult);
103 - assert.deepEqual(target, expectedTarget);
104 - assert.deepEqual(keys, expectedKeys);
105 -});
106 -
107 -// supports full value, key, callback (shortcut) interface
108 -function asyncJob(item, key, cb)
109 -{
110 - // different delays (in ms) per item
111 - var delay = item * 25;
112 -
113 - // pretend different jobs take different time to finish
114 - // and not in consequential order
115 - var timeoutId = setTimeout(function() {
116 - keys.push(key);
117 - target.push(item);
118 - cb(null, item * 2);
119 - }, delay);
120 -
121 - // allow to cancel "leftover" jobs upon error
122 - // return function, invoking of which will abort this job
123 - return clearTimeout.bind(null, timeoutId);
124 -}
125 -```
126 -
127 -More examples could be found in [test/test-parallel-object.js](test/test-parallel-object.js).
128 -
129 -### Serial Jobs
130 -
131 -Runs iterator over provided array sequentially. Stores output in the `result` array,
132 -on the matching positions. In unlikely event of an error from one of the jobs,
133 -will not proceed to the rest of the items in the list
134 -and return error along with salvaged data to the main callback function.
135 -
136 -#### Input Array
137 -
138 -```javascript
139 -var serial = require('asynckit/serial')
140 - , assert = require('assert')
141 - ;
142 -
143 -var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ]
144 - , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ]
145 - , expectedTarget = [ 0, 1, 2, 3, 4, 5, 6, 7 ]
146 - , target = []
147 - ;
148 -
149 -serial(source, asyncJob, function(err, result)
150 -{
151 - assert.deepEqual(result, expectedResult);
152 - assert.deepEqual(target, expectedTarget);
153 -});
154 -
155 -// extended interface (item, key, callback)
156 -// also supported for arrays
157 -function asyncJob(item, key, cb)
158 -{
159 - target.push(key);
160 -
161 - // it will be automatically made async
162 - // even it iterator "returns" in the same event loop
163 - cb(null, item * 2);
164 -}
165 -```
166 -
167 -More examples could be found in [test/test-serial-array.js](test/test-serial-array.js).
168 -
169 -#### Input Object
170 -
171 -Also it supports named jobs, listed via object.
172 -
173 -```javascript
174 -var serial = require('asynckit').serial
175 - , assert = require('assert')
176 - ;
177 -
178 -var source = [ 1, 1, 4, 16, 64, 32, 8, 2 ]
179 - , expectedResult = [ 2, 2, 8, 32, 128, 64, 16, 4 ]
180 - , expectedTarget = [ 0, 1, 2, 3, 4, 5, 6, 7 ]
181 - , target = []
182 - ;
183 -
184 -var source = { first: 1, one: 1, four: 4, sixteen: 16, sixtyFour: 64, thirtyTwo: 32, eight: 8, two: 2 }
185 - , expectedResult = { first: 2, one: 2, four: 8, sixteen: 32, sixtyFour: 128, thirtyTwo: 64, eight: 16, two: 4 }
186 - , expectedTarget = [ 1, 1, 4, 16, 64, 32, 8, 2 ]
187 - , target = []
188 - ;
189 -
190 -
191 -serial(source, asyncJob, function(err, result)
192 -{
193 - assert.deepEqual(result, expectedResult);
194 - assert.deepEqual(target, expectedTarget);
195 -});
196 -
197 -// shortcut interface (item, callback)
198 -// works for object as well as for the arrays
199 -function asyncJob(item, cb)
200 -{
201 - target.push(item);
202 -
203 - // it will be automatically made async
204 - // even it iterator "returns" in the same event loop
205 - cb(null, item * 2);
206 -}
207 -```
208 -
209 -More examples could be found in [test/test-serial-object.js](test/test-serial-object.js).
210 -
211 -_Note: Since _object_ is an _unordered_ collection of properties,
212 -it may produce unexpected results with sequential iterations.
213 -Whenever order of the jobs' execution is important please use `serialOrdered` method._
214 -
215 -### Ordered Serial Iterations
216 -
217 -TBD
218 -
219 -For example [compare-property](compare-property) package.
220 -
221 -### Streaming interface
222 -
223 -TBD
224 -
225 -## Want to Know More?
226 -
227 -More examples can be found in [test folder](test/).
228 -
229 -Or open an [issue](https://github.com/alexindigo/asynckit/issues) with questions and/or suggestions.
230 -
231 -## License
232 -
233 -AsyncKit is licensed under the MIT license.
1 -/* eslint no-console: "off" */
2 -
3 -var asynckit = require('./')
4 - , async = require('async')
5 - , assert = require('assert')
6 - , expected = 0
7 - ;
8 -
9 -var Benchmark = require('benchmark');
10 -var suite = new Benchmark.Suite;
11 -
12 -var source = [];
13 -for (var z = 1; z < 100; z++)
14 -{
15 - source.push(z);
16 - expected += z;
17 -}
18 -
19 -suite
20 -// add tests
21 -
22 -.add('async.map', function(deferred)
23 -{
24 - var total = 0;
25 -
26 - async.map(source,
27 - function(i, cb)
28 - {
29 - setImmediate(function()
30 - {
31 - total += i;
32 - cb(null, total);
33 - });
34 - },
35 - function(err, result)
36 - {
37 - assert.ifError(err);
38 - assert.equal(result[result.length - 1], expected);
39 - deferred.resolve();
40 - });
41 -}, {'defer': true})
42 -
43 -
44 -.add('asynckit.parallel', function(deferred)
45 -{
46 - var total = 0;
47 -
48 - asynckit.parallel(source,
49 - function(i, cb)
50 - {
51 - setImmediate(function()
52 - {
53 - total += i;
54 - cb(null, total);
55 - });
56 - },
57 - function(err, result)
58 - {
59 - assert.ifError(err);
60 - assert.equal(result[result.length - 1], expected);
61 - deferred.resolve();
62 - });
63 -}, {'defer': true})
64 -
65 -
66 -// add listeners
67 -.on('cycle', function(ev)
68 -{
69 - console.log(String(ev.target));
70 -})
71 -.on('complete', function()
72 -{
73 - console.log('Fastest is ' + this.filter('fastest').map('name'));
74 -})
75 -// run async
76 -.run({ 'async': true });
1 -// API
2 -module.exports = abort;
3 -
4 -/**
5 - * Aborts leftover active jobs
6 - *
7 - * @param {object} state - current state object
8 - */
9 -function abort(state)
10 -{
11 - Object.keys(state.jobs).forEach(clean.bind(state));
12 -
13 - // reset leftover jobs
14 - state.jobs = {};
15 -}
16 -
17 -/**
18 - * Cleans up leftover job by invoking abort function for the provided job id
19 - *
20 - * @this state
21 - * @param {string|number} key - job id to abort
22 - */
23 -function clean(key)
24 -{
25 - if (typeof this.jobs[key] == 'function')
26 - {
27 - this.jobs[key]();
28 - }
29 -}
1 -var defer = require('./defer.js');
2 -
3 -// API
4 -module.exports = async;
5 -
6 -/**
7 - * Runs provided callback asynchronously
8 - * even if callback itself is not
9 - *
10 - * @param {function} callback - callback to invoke
11 - * @returns {function} - augmented callback
12 - */
13 -function async(callback)
14 -{
15 - var isAsync = false;
16 -
17 - // check if async happened
18 - defer(function() { isAsync = true; });
19 -
20 - return function async_callback(err, result)
21 - {
22 - if (isAsync)
23 - {
24 - callback(err, result);
25 - }
26 - else
27 - {
28 - defer(function nextTick_callback()
29 - {
30 - callback(err, result);
31 - });
32 - }
33 - };
34 -}
1 -var async = require('./async.js')
2 - , abort = require('./abort.js')
3 - ;
4 -
5 -// API
6 -module.exports = iterate;
7 -
8 -/**
9 - * Iterates over each job object
10 - *
11 - * @param {array|object} list - array or object (named list) to iterate over
12 - * @param {function} iterator - iterator to run
13 - * @param {object} state - current job status
14 - * @param {function} callback - invoked when all elements processed
15 - */
16 -function iterate(list, iterator, state, callback)
17 -{
18 - // store current index
19 - var key = state['keyedList'] ? state['keyedList'][state.index] : state.index;
20 -
21 - state.jobs[key] = runJob(iterator, key, list[key], function(error, output)
22 - {
23 - // don't repeat yourself
24 - // skip secondary callbacks
25 - if (!(key in state.jobs))
26 - {
27 - return;
28 - }
29 -
30 - // clean up jobs
31 - delete state.jobs[key];
32 -
33 - if (error)
34 - {
35 - // don't process rest of the results
36 - // stop still active jobs
37 - // and reset the list
38 - abort(state);
39 - }
40 - else
41 - {
42 - state.results[key] = output;
43 - }
44 -
45 - // return salvaged results
46 - callback(error, state.results);
47 - });
48 -}
49 -
50 -/**
51 - * Runs iterator over provided job element
52 - *
53 - * @param {function} iterator - iterator to invoke
54 - * @param {string|number} key - key/index of the element in the list of jobs
55 - * @param {mixed} item - job description
56 - * @param {function} callback - invoked after iterator is done with the job
57 - * @returns {function|mixed} - job abort function or something else
58 - */
59 -function runJob(iterator, key, item, callback)
60 -{
61 - var aborter;
62 -
63 - // allow shortcut if iterator expects only two arguments
64 - if (iterator.length == 2)
65 - {
66 - aborter = iterator(item, async(callback));
67 - }
68 - // otherwise go with full three arguments
69 - else
70 - {
71 - aborter = iterator(item, key, async(callback));
72 - }
73 -
74 - return aborter;
75 -}
1 -var streamify = require('./streamify.js')
2 - , defer = require('./defer.js')
3 - ;
4 -
5 -// API
6 -module.exports = ReadableAsyncKit;
7 -
8 -/**
9 - * Base constructor for all streams
10 - * used to hold properties/methods
11 - */
12 -function ReadableAsyncKit()
13 -{
14 - ReadableAsyncKit.super_.apply(this, arguments);
15 -
16 - // list of active jobs
17 - this.jobs = {};
18 -
19 - // add stream methods
20 - this.destroy = destroy;
21 - this._start = _start;
22 - this._read = _read;
23 -}
24 -
25 -/**
26 - * Destroys readable stream,
27 - * by aborting outstanding jobs
28 - *
29 - * @returns {void}
30 - */
31 -function destroy()
32 -{
33 - if (this.destroyed)
34 - {
35 - return;
36 - }
37 -
38 - this.destroyed = true;
39 -
40 - if (typeof this.terminator == 'function')
41 - {
42 - this.terminator();
43 - }
44 -}
45 -
46 -/**
47 - * Starts provided jobs in async manner
48 - *
49 - * @private
50 - */
51 -function _start()
52 -{
53 - // first argument – runner function
54 - var runner = arguments[0]
55 - // take away first argument
56 - , args = Array.prototype.slice.call(arguments, 1)
57 - // second argument - input data
58 - , input = args[0]
59 - // last argument - result callback
60 - , endCb = streamify.callback.call(this, args[args.length - 1])
61 - ;
62 -
63 - args[args.length - 1] = endCb;
64 - // third argument - iterator
65 - args[1] = streamify.iterator.call(this, args[1]);
66 -
67 - // allow time for proper setup
68 - defer(function()
69 - {
70 - if (!this.destroyed)
71 - {
72 - this.terminator = runner.apply(null, args);
73 - }
74 - else
75 - {
76 - endCb(null, Array.isArray(input) ? [] : {});
77 - }
78 - }.bind(this));
79 -}
80 -
81 -
82 -/**
83 - * Implement _read to comply with Readable streams
84 - * Doesn't really make sense for flowing object mode
85 - *
86 - * @private
87 - */
88 -function _read()
89 -{
90 -
91 -}
1 -var parallel = require('../parallel.js');
2 -
3 -// API
4 -module.exports = ReadableParallel;
5 -
6 -/**
7 - * Streaming wrapper to `asynckit.parallel`
8 - *
9 - * @param {array|object} list - array or object (named list) to iterate over
10 - * @param {function} iterator - iterator to run
11 - * @param {function} callback - invoked when all elements processed
12 - * @returns {stream.Readable#}
13 - */
14 -function ReadableParallel(list, iterator, callback)
15 -{
16 - if (!(this instanceof ReadableParallel))
17 - {
18 - return new ReadableParallel(list, iterator, callback);
19 - }
20 -
21 - // turn on object mode
22 - ReadableParallel.super_.call(this, {objectMode: true});
23 -
24 - this._start(parallel, list, iterator, callback);
25 -}
1 -var serial = require('../serial.js');
2 -
3 -// API
4 -module.exports = ReadableSerial;
5 -
6 -/**
7 - * Streaming wrapper to `asynckit.serial`
8 - *
9 - * @param {array|object} list - array or object (named list) to iterate over
10 - * @param {function} iterator - iterator to run
11 - * @param {function} callback - invoked when all elements processed
12 - * @returns {stream.Readable#}
13 - */
14 -function ReadableSerial(list, iterator, callback)
15 -{
16 - if (!(this instanceof ReadableSerial))
17 - {
18 - return new ReadableSerial(list, iterator, callback);
19 - }
20 -
21 - // turn on object mode
22 - ReadableSerial.super_.call(this, {objectMode: true});
23 -
24 - this._start(serial, list, iterator, callback);
25 -}
1 -var serialOrdered = require('../serialOrdered.js');
2 -
3 -// API
4 -module.exports = ReadableSerialOrdered;
5 -// expose sort helpers
6 -module.exports.ascending = serialOrdered.ascending;
7 -module.exports.descending = serialOrdered.descending;
8 -
9 -/**
10 - * Streaming wrapper to `asynckit.serialOrdered`
11 - *
12 - * @param {array|object} list - array or object (named list) to iterate over
13 - * @param {function} iterator - iterator to run
14 - * @param {function} sortMethod - custom sort function
15 - * @param {function} callback - invoked when all elements processed
16 - * @returns {stream.Readable#}
17 - */
18 -function ReadableSerialOrdered(list, iterator, sortMethod, callback)
19 -{
20 - if (!(this instanceof ReadableSerialOrdered))
21 - {
22 - return new ReadableSerialOrdered(list, iterator, sortMethod, callback);
23 - }
24 -
25 - // turn on object mode
26 - ReadableSerialOrdered.super_.call(this, {objectMode: true});
27 -
28 - this._start(serialOrdered, list, iterator, sortMethod, callback);
29 -}
1 -// API
2 -module.exports = state;
3 -
4 -/**
5 - * Creates initial state object
6 - * for iteration over list
7 - *
8 - * @param {array|object} list - list to iterate over
9 - * @param {function|null} sortMethod - function to use for keys sort,
10 - * or `null` to keep them as is
11 - * @returns {object} - initial state object
12 - */
13 -function state(list, sortMethod)
14 -{
15 - var isNamedList = !Array.isArray(list)
16 - , initState =
17 - {
18 - index : 0,
19 - keyedList: isNamedList || sortMethod ? Object.keys(list) : null,
20 - jobs : {},
21 - results : isNamedList ? {} : [],
22 - size : isNamedList ? Object.keys(list).length : list.length
23 - }
24 - ;
25 -
26 - if (sortMethod)
27 - {
28 - // sort array keys based on it's values
29 - // sort object's keys just on own merit
30 - initState.keyedList.sort(isNamedList ? sortMethod : function(a, b)
31 - {
32 - return sortMethod(list[a], list[b]);
33 - });
34 - }
35 -
36 - return initState;
37 -}
1 -var async = require('./async.js');
2 -
3 -// API
4 -module.exports = {
5 - iterator: wrapIterator,
6 - callback: wrapCallback
7 -};
8 -
9 -/**
10 - * Wraps iterators with long signature
11 - *
12 - * @this ReadableAsyncKit#
13 - * @param {function} iterator - function to wrap
14 - * @returns {function} - wrapped function
15 - */
16 -function wrapIterator(iterator)
17 -{
18 - var stream = this;
19 -
20 - return function(item, key, cb)
21 - {
22 - var aborter
23 - , wrappedCb = async(wrapIteratorCallback.call(stream, cb, key))
24 - ;
25 -
26 - stream.jobs[key] = wrappedCb;
27 -
28 - // it's either shortcut (item, cb)
29 - if (iterator.length == 2)
30 - {
31 - aborter = iterator(item, wrappedCb);
32 - }
33 - // or long format (item, key, cb)
34 - else
35 - {
36 - aborter = iterator(item, key, wrappedCb);
37 - }
38 -
39 - return aborter;
40 - };
41 -}
42 -
43 -/**
44 - * Wraps provided callback function
45 - * allowing to execute snitch function before
46 - * real callback
47 - *
48 - * @this ReadableAsyncKit#
49 - * @param {function} callback - function to wrap
50 - * @returns {function} - wrapped function
51 - */
52 -function wrapCallback(callback)
53 -{
54 - var stream = this;
55 -
56 - var wrapped = function(error, result)
57 - {
58 - return finisher.call(stream, error, result, callback);
59 - };
60 -
61 - return wrapped;
62 -}
63 -
64 -/**
65 - * Wraps provided iterator callback function
66 - * makes sure snitch only called once,
67 - * but passes secondary calls to the original callback
68 - *
69 - * @this ReadableAsyncKit#
70 - * @param {function} callback - callback to wrap
71 - * @param {number|string} key - iteration key
72 - * @returns {function} wrapped callback
73 - */
74 -function wrapIteratorCallback(callback, key)
75 -{
76 - var stream = this;
77 -
78 - return function(error, output)
79 - {
80 - // don't repeat yourself
81 - if (!(key in stream.jobs))
82 - {
83 - callback(error, output);
84 - return;
85 - }
86 -
87 - // clean up jobs
88 - delete stream.jobs[key];
89 -
90 - return streamer.call(stream, error, {key: key, value: output}, callback);
91 - };
92 -}
93 -
94 -/**
95 - * Stream wrapper for iterator callback
96 - *
97 - * @this ReadableAsyncKit#
98 - * @param {mixed} error - error response
99 - * @param {mixed} output - iterator output
100 - * @param {function} callback - callback that expects iterator results
101 - */
102 -function streamer(error, output, callback)
103 -{
104 - if (error && !this.error)
105 - {
106 - this.error = error;
107 - this.pause();
108 - this.emit('error', error);
109 - // send back value only, as expected
110 - callback(error, output && output.value);
111 - return;
112 - }
113 -
114 - // stream stuff
115 - this.push(output);
116 -
117 - // back to original track
118 - // send back value only, as expected
119 - callback(error, output && output.value);
120 -}
121 -
122 -/**
123 - * Stream wrapper for finishing callback
124 - *
125 - * @this ReadableAsyncKit#
126 - * @param {mixed} error - error response
127 - * @param {mixed} output - iterator output
128 - * @param {function} callback - callback that expects final results
129 - */
130 -function finisher(error, output, callback)
131 -{
132 - // signal end of the stream
133 - // only for successfully finished streams
134 - if (!error)
135 - {
136 - this.push(null);
137 - }
138 -
139 - // back to original track
140 - callback(error, output);
141 -}
1 -var abort = require('./abort.js')
2 - , async = require('./async.js')
3 - ;
4 -
5 -// API
6 -module.exports = terminator;
7 -
8 -/**
9 - * Terminates jobs in the attached state context
10 - *
11 - * @this AsyncKitState#
12 - * @param {function} callback - final callback to invoke after termination
13 - */
14 -function terminator(callback)
15 -{
16 - if (!Object.keys(this.jobs).length)
17 - {
18 - return;
19 - }
20 -
21 - // fast forward iteration index
22 - this.index = this.size;
23 -
24 - // abort jobs
25 - abort(this);
26 -
27 - // send back results we have so far
28 - async(callback)(null, this.results);
29 -}
1 -{
2 - "name": "asynckit",
3 - "version": "0.4.0",
4 - "description": "Minimal async jobs utility library, with streams support",
5 - "main": "index.js",
6 - "scripts": {
7 - "clean": "rimraf coverage",
8 - "lint": "eslint *.js lib/*.js test/*.js",
9 - "test": "istanbul cover --reporter=json tape -- 'test/test-*.js' | tap-spec",
10 - "win-test": "tape test/test-*.js",
11 - "browser": "browserify -t browserify-istanbul test/lib/browserify_adjustment.js test/test-*.js | obake --coverage | tap-spec",
12 - "report": "istanbul report",
13 - "size": "browserify index.js | size-table asynckit",
14 - "debug": "tape test/test-*.js"
15 - },
16 - "pre-commit": [
17 - "clean",
18 - "lint",
19 - "test",
20 - "browser",
21 - "report",
22 - "size"
23 - ],
24 - "repository": {
25 - "type": "git",
26 - "url": "git+https://github.com/alexindigo/asynckit.git"
27 - },
28 - "keywords": [
29 - "async",
30 - "jobs",
31 - "parallel",
32 - "serial",
33 - "iterator",
34 - "array",
35 - "object",
36 - "stream",
37 - "destroy",
38 - "terminate",
39 - "abort"
40 - ],
41 - "author": "Alex Indigo <iam@alexindigo.com>",
42 - "license": "MIT",
43 - "bugs": {
44 - "url": "https://github.com/alexindigo/asynckit/issues"
45 - },
46 - "homepage": "https://github.com/alexindigo/asynckit#readme",
47 - "devDependencies": {
48 - "browserify": "^13.0.0",
49 - "browserify-istanbul": "^2.0.0",
50 - "coveralls": "^2.11.9",
51 - "eslint": "^2.9.0",
52 - "istanbul": "^0.4.3",
53 - "obake": "^0.1.2",
54 - "phantomjs-prebuilt": "^2.1.7",
55 - "pre-commit": "^1.1.3",
56 - "reamde": "^1.1.0",
57 - "rimraf": "^2.5.2",
58 - "size-table": "^0.2.0",
59 - "tap-spec": "^4.1.1",
60 - "tape": "^4.5.1"
61 - },
62 - "dependencies": {}
63 -}
1 -var iterate = require('./lib/iterate.js')
2 - , initState = require('./lib/state.js')
3 - , terminator = require('./lib/terminator.js')
4 - ;
5 -
6 -// Public API
7 -module.exports = parallel;
8 -
9 -/**
10 - * Runs iterator over provided array elements in parallel
11 - *
12 - * @param {array|object} list - array or object (named list) to iterate over
13 - * @param {function} iterator - iterator to run
14 - * @param {function} callback - invoked when all elements processed
15 - * @returns {function} - jobs terminator
16 - */
17 -function parallel(list, iterator, callback)
18 -{
19 - var state = initState(list);
20 -
21 - while (state.index < (state['keyedList'] || list).length)
22 - {
23 - iterate(list, iterator, state, function(error, result)
24 - {
25 - if (error)
26 - {
27 - callback(error, result);
28 - return;
29 - }
30 -
31 - // looks like it's the last one
32 - if (Object.keys(state.jobs).length === 0)
33 - {
34 - callback(null, state.results);
35 - return;
36 - }
37 - });
38 -
39 - state.index++;
40 - }
41 -
42 - return terminator.bind(state, callback);
43 -}
1 -var serialOrdered = require('./serialOrdered.js');
2 -
3 -// Public API
4 -module.exports = serial;
5 -
6 -/**
7 - * Runs iterator over provided array elements in series
8 - *
9 - * @param {array|object} list - array or object (named list) to iterate over
10 - * @param {function} iterator - iterator to run
11 - * @param {function} callback - invoked when all elements processed
12 - * @returns {function} - jobs terminator
13 - */
14 -function serial(list, iterator, callback)
15 -{
16 - return serialOrdered(list, iterator, null, callback);
17 -}
1 -var iterate = require('./lib/iterate.js')
2 - , initState = require('./lib/state.js')
3 - , terminator = require('./lib/terminator.js')
4 - ;
5 -
6 -// Public API
7 -module.exports = serialOrdered;
8 -// sorting helpers
9 -module.exports.ascending = ascending;
10 -module.exports.descending = descending;
11 -
12 -/**
13 - * Runs iterator over provided sorted array elements in series
14 - *
15 - * @param {array|object} list - array or object (named list) to iterate over
16 - * @param {function} iterator - iterator to run
17 - * @param {function} sortMethod - custom sort function
18 - * @param {function} callback - invoked when all elements processed
19 - * @returns {function} - jobs terminator
20 - */
21 -function serialOrdered(list, iterator, sortMethod, callback)
22 -{
23 - var state = initState(list, sortMethod);
24 -
25 - iterate(list, iterator, state, function iteratorHandler(error, result)
26 - {
27 - if (error)
28 - {
29 - callback(error, result);
30 - return;
31 - }
32 -
33 - state.index++;
34 -
35 - // are we there yet?
36 - if (state.index < (state['keyedList'] || list).length)
37 - {
38 - iterate(list, iterator, state, iteratorHandler);
39 - return;
40 - }
41 -
42 - // done here
43 - callback(null, state.results);
44 - });
45 -
46 - return terminator.bind(state, callback);
47 -}
48 -
49 -/*
50 - * -- Sort methods
51 - */
52 -
53 -/**
54 - * sort helper to sort array elements in ascending order
55 - *
56 - * @param {mixed} a - an item to compare
57 - * @param {mixed} b - an item to compare
58 - * @returns {number} - comparison result
59 - */
60 -function ascending(a, b)
61 -{
62 - return a < b ? -1 : a > b ? 1 : 0;
63 -}
64 -
65 -/**
66 - * sort helper to sort array elements in descending order
67 - *
68 - * @param {mixed} a - an item to compare
69 - * @param {mixed} b - an item to compare
70 - * @returns {number} - comparison result
71 - */
72 -function descending(a, b)
73 -{
74 - return -1 * ascending(a, b);
75 -}
1 -var inherits = require('util').inherits
2 - , Readable = require('stream').Readable
3 - , ReadableAsyncKit = require('./lib/readable_asynckit.js')
4 - , ReadableParallel = require('./lib/readable_parallel.js')
5 - , ReadableSerial = require('./lib/readable_serial.js')
6 - , ReadableSerialOrdered = require('./lib/readable_serial_ordered.js')
7 - ;
8 -
9 -// API
10 -module.exports =
11 -{
12 - parallel : ReadableParallel,
13 - serial : ReadableSerial,
14 - serialOrdered : ReadableSerialOrdered,
15 -};
16 -
17 -inherits(ReadableAsyncKit, Readable);
18 -
19 -inherits(ReadableParallel, ReadableAsyncKit);
20 -inherits(ReadableSerial, ReadableAsyncKit);
21 -inherits(ReadableSerialOrdered, ReadableAsyncKit);
1 -
2 -/*!
3 - * Copyright 2010 LearnBoost <dev@learnboost.com>
4 - *
5 - * Licensed under the Apache License, Version 2.0 (the "License");
6 - * you may not use this file except in compliance with the License.
7 - * You may obtain a copy of the License at
8 - *
9 - * http://www.apache.org/licenses/LICENSE-2.0
10 - *
11 - * Unless required by applicable law or agreed to in writing, software
12 - * distributed under the License is distributed on an "AS IS" BASIS,
13 - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 - * See the License for the specific language governing permissions and
15 - * limitations under the License.
16 - */
17 -
18 -/**
19 - * Module dependencies.
20 - */
21 -
22 -var crypto = require('crypto')
23 - , parse = require('url').parse
24 - ;
25 -
26 -/**
27 - * Valid keys.
28 - */
29 -
30 -var keys =
31 - [ 'acl'
32 - , 'location'
33 - , 'logging'
34 - , 'notification'
35 - , 'partNumber'
36 - , 'policy'
37 - , 'requestPayment'
38 - , 'torrent'
39 - , 'uploadId'
40 - , 'uploads'
41 - , 'versionId'
42 - , 'versioning'
43 - , 'versions'
44 - , 'website'
45 - ]
46 -
47 -/**
48 - * Return an "Authorization" header value with the given `options`
49 - * in the form of "AWS <key>:<signature>"
50 - *
51 - * @param {Object} options
52 - * @return {String}
53 - * @api private
54 - */
55 -
56 -function authorization (options) {
57 - return 'AWS ' + options.key + ':' + sign(options)
58 -}
59 -
60 -module.exports = authorization
61 -module.exports.authorization = authorization
62 -
63 -/**
64 - * Simple HMAC-SHA1 Wrapper
65 - *
66 - * @param {Object} options
67 - * @return {String}
68 - * @api private
69 - */
70 -
71 -function hmacSha1 (options) {
72 - return crypto.createHmac('sha1', options.secret).update(options.message).digest('base64')
73 -}
74 -
75 -module.exports.hmacSha1 = hmacSha1
76 -
77 -/**
78 - * Create a base64 sha1 HMAC for `options`.
79 - *
80 - * @param {Object} options
81 - * @return {String}
82 - * @api private
83 - */
84 -
85 -function sign (options) {
86 - options.message = stringToSign(options)
87 - return hmacSha1(options)
88 -}
89 -module.exports.sign = sign
90 -
91 -/**
92 - * Create a base64 sha1 HMAC for `options`.
93 - *
94 - * Specifically to be used with S3 presigned URLs
95 - *
96 - * @param {Object} options
97 - * @return {String}
98 - * @api private
99 - */
100 -
101 -function signQuery (options) {
102 - options.message = queryStringToSign(options)
103 - return hmacSha1(options)
104 -}
105 -module.exports.signQuery= signQuery
106 -
107 -/**
108 - * Return a string for sign() with the given `options`.
109 - *
110 - * Spec:
111 - *
112 - * <verb>\n
113 - * <md5>\n
114 - * <content-type>\n
115 - * <date>\n
116 - * [headers\n]
117 - * <resource>
118 - *
119 - * @param {Object} options
120 - * @return {String}
121 - * @api private
122 - */
123 -
124 -function stringToSign (options) {
125 - var headers = options.amazonHeaders || ''
126 - if (headers) headers += '\n'
127 - var r =
128 - [ options.verb
129 - , options.md5
130 - , options.contentType
131 - , options.date ? options.date.toUTCString() : ''
132 - , headers + options.resource
133 - ]
134 - return r.join('\n')
135 -}
136 -module.exports.stringToSign = stringToSign
137 -
138 -/**
139 - * Return a string for sign() with the given `options`, but is meant exclusively
140 - * for S3 presigned URLs
141 - *
142 - * Spec:
143 - *
144 - * <date>\n
145 - * <resource>
146 - *
147 - * @param {Object} options
148 - * @return {String}
149 - * @api private
150 - */
151 -
152 -function queryStringToSign (options){
153 - return 'GET\n\n\n' + options.date + '\n' + options.resource
154 -}
155 -module.exports.queryStringToSign = queryStringToSign
156 -
157 -/**
158 - * Perform the following:
159 - *
160 - * - ignore non-amazon headers
161 - * - lowercase fields
162 - * - sort lexicographically
163 - * - trim whitespace between ":"
164 - * - join with newline
165 - *
166 - * @param {Object} headers
167 - * @return {String}
168 - * @api private
169 - */
170 -
171 -function canonicalizeHeaders (headers) {
172 - var buf = []
173 - , fields = Object.keys(headers)
174 - ;
175 - for (var i = 0, len = fields.length; i < len; ++i) {
176 - var field = fields[i]
177 - , val = headers[field]
178 - , field = field.toLowerCase()
179 - ;
180 - if (0 !== field.indexOf('x-amz')) continue
181 - buf.push(field + ':' + val)
182 - }
183 - return buf.sort().join('\n')
184 -}
185 -module.exports.canonicalizeHeaders = canonicalizeHeaders
186 -
187 -/**
188 - * Perform the following:
189 - *
190 - * - ignore non sub-resources
191 - * - sort lexicographically
192 - *
193 - * @param {String} resource
194 - * @return {String}
195 - * @api private
196 - */
197 -
198 -function canonicalizeResource (resource) {
199 - var url = parse(resource, true)
200 - , path = url.pathname
201 - , buf = []
202 - ;
203 -
204 - Object.keys(url.query).forEach(function(key){
205 - if (!~keys.indexOf(key)) return
206 - var val = '' == url.query[key] ? '' : '=' + encodeURIComponent(url.query[key])
207 - buf.push(key + val)
208 - })
209 -
210 - return path + (buf.length ? '?' + buf.sort().join('&') : '')
211 -}
212 -module.exports.canonicalizeResource = canonicalizeResource
1 -{
2 - "author": "Mikeal Rogers <mikeal.rogers@gmail.com> (http://www.futurealoof.com)",
3 - "name": "aws-sign2",
4 - "description": "AWS signing. Originally pulled from LearnBoost/knox, maintained as vendor in request, now a standalone module.",
5 - "version": "0.7.0",
6 - "repository": {
7 - "url": "https://github.com/mikeal/aws-sign"
8 - },
9 - "license": "Apache-2.0",
10 - "main": "index.js",
11 - "dependencies": {},
12 - "devDependencies": {},
13 - "optionalDependencies": {},
14 - "engines": {
15 - "node": "*"
16 - }
17 -}
1 -# These are supported funding model platforms
2 -
3 -github: mhart
1 -language: node_js
2 -node_js:
3 - - "0.10"
4 - - "0.12"
5 - - "4"
6 - - "6"
7 - - "8"
8 - - "10"
9 - - "12"
1 -Copyright 2013 Michael Hart (michael.hart.au@gmail.com)
2 -
3 -Permission is hereby granted, free of charge, to any person obtaining a copy of
4 -this software and associated documentation files (the "Software"), to deal in
5 -the Software without restriction, including without limitation the rights to
6 -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7 -of the Software, and to permit persons to whom the Software is furnished to do
8 -so, subject to the following conditions:
9 -
10 -The above copyright notice and this permission notice shall be included in all
11 -copies or substantial portions of the Software.
12 -
13 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16 -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17 -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18 -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19 -SOFTWARE.
1 -aws4
2 -----
3 -
4 -[![Build Status](https://api.travis-ci.org/mhart/aws4.png?branch=master)](https://travis-ci.org/github/mhart/aws4)
5 -
6 -A small utility to sign vanilla Node.js http(s) request options using Amazon's
7 -[AWS Signature Version 4](https://docs.aws.amazon.com/general/latest/gr/signature-version-4.html).
8 -
9 -If you want to sign and send AWS requests in a modern browser, or an environment like [Cloudflare Workers](https://developers.cloudflare.com/workers/), then check out [aws4fetch](https://github.com/mhart/aws4fetch) – otherwise you can also bundle this library for use [in older browsers](./browser).
10 -
11 -The only AWS service that *doesn't* support v4 as of 2020-05-22 is
12 -[SimpleDB](https://docs.aws.amazon.com/AmazonSimpleDB/latest/DeveloperGuide/SDB_API.html)
13 -(it only supports [AWS Signature Version 2](https://github.com/mhart/aws2)).
14 -
15 -It also provides defaults for a number of core AWS headers and
16 -request parameters, making it very easy to query AWS services, or
17 -build out a fully-featured AWS library.
18 -
19 -Example
20 --------
21 -
22 -```javascript
23 -var https = require('https')
24 -var aws4 = require('aws4')
25 -
26 -// to illustrate usage, we'll create a utility function to request and pipe to stdout
27 -function request(opts) { https.request(opts, function(res) { res.pipe(process.stdout) }).end(opts.body || '') }
28 -
29 -// aws4 will sign an options object as you'd pass to http.request, with an AWS service and region
30 -var opts = { host: 'my-bucket.s3.us-west-1.amazonaws.com', path: '/my-object', service: 's3', region: 'us-west-1' }
31 -
32 -// aws4.sign() will sign and modify these options, ready to pass to http.request
33 -aws4.sign(opts, { accessKeyId: '', secretAccessKey: '' })
34 -
35 -// or it can get credentials from process.env.AWS_ACCESS_KEY_ID, etc
36 -aws4.sign(opts)
37 -
38 -// for most AWS services, aws4 can figure out the service and region if you pass a host
39 -opts = { host: 'my-bucket.s3.us-west-1.amazonaws.com', path: '/my-object' }
40 -
41 -// usually it will add/modify request headers, but you can also sign the query:
42 -opts = { host: 'my-bucket.s3.amazonaws.com', path: '/?X-Amz-Expires=12345', signQuery: true }
43 -
44 -// and for services with simple hosts, aws4 can infer the host from service and region:
45 -opts = { service: 'sqs', region: 'us-east-1', path: '/?Action=ListQueues' }
46 -
47 -// and if you're using us-east-1, it's the default:
48 -opts = { service: 'sqs', path: '/?Action=ListQueues' }
49 -
50 -aws4.sign(opts)
51 -console.log(opts)
52 -/*
53 -{
54 - host: 'sqs.us-east-1.amazonaws.com',
55 - path: '/?Action=ListQueues',
56 - headers: {
57 - Host: 'sqs.us-east-1.amazonaws.com',
58 - 'X-Amz-Date': '20121226T061030Z',
59 - Authorization: 'AWS4-HMAC-SHA256 Credential=ABCDEF/20121226/us-east-1/sqs/aws4_request, ...'
60 - }
61 -}
62 -*/
63 -
64 -// we can now use this to query AWS
65 -request(opts)
66 -/*
67 -<?xml version="1.0"?>
68 -<ListQueuesResponse xmlns="https://queue.amazonaws.com/doc/2012-11-05/">
69 -...
70 -*/
71 -
72 -// aws4 can infer the HTTP method if a body is passed in
73 -// method will be POST and Content-Type: 'application/x-www-form-urlencoded; charset=utf-8'
74 -request(aws4.sign({ service: 'iam', body: 'Action=ListGroups&Version=2010-05-08' }))
75 -/*
76 -<ListGroupsResponse xmlns="https://iam.amazonaws.com/doc/2010-05-08/">
77 -...
78 -*/
79 -
80 -// you can specify any custom option or header as per usual
81 -request(aws4.sign({
82 - service: 'dynamodb',
83 - region: 'ap-southeast-2',
84 - method: 'POST',
85 - path: '/',
86 - headers: {
87 - 'Content-Type': 'application/x-amz-json-1.0',
88 - 'X-Amz-Target': 'DynamoDB_20120810.ListTables'
89 - },
90 - body: '{}'
91 -}))
92 -/*
93 -{"TableNames":[]}
94 -...
95 -*/
96 -
97 -// The raw RequestSigner can be used to generate CodeCommit Git passwords
98 -var signer = new aws4.RequestSigner({
99 - service: 'codecommit',
100 - host: 'git-codecommit.us-east-1.amazonaws.com',
101 - method: 'GIT',
102 - path: '/v1/repos/MyAwesomeRepo',
103 -})
104 -var password = signer.getDateTime() + 'Z' + signer.signature()
105 -
106 -// see example.js for examples with other services
107 -```
108 -
109 -API
110 ----
111 -
112 -### aws4.sign(requestOptions, [credentials])
113 -
114 -Calculates and populates any necessary AWS headers and/or request
115 -options on `requestOptions`. Returns `requestOptions` as a convenience for chaining.
116 -
117 -`requestOptions` is an object holding the same options that the Node.js
118 -[http.request](https://nodejs.org/docs/latest/api/http.html#http_http_request_options_callback)
119 -function takes.
120 -
121 -The following properties of `requestOptions` are used in the signing or
122 -populated if they don't already exist:
123 -
124 -- `hostname` or `host` (will try to be determined from `service` and `region` if not given)
125 -- `method` (will use `'GET'` if not given or `'POST'` if there is a `body`)
126 -- `path` (will use `'/'` if not given)
127 -- `body` (will use `''` if not given)
128 -- `service` (will try to be calculated from `hostname` or `host` if not given)
129 -- `region` (will try to be calculated from `hostname` or `host` or use `'us-east-1'` if not given)
130 -- `signQuery` (to sign the query instead of adding an `Authorization` header, defaults to false)
131 -- `headers['Host']` (will use `hostname` or `host` or be calculated if not given)
132 -- `headers['Content-Type']` (will use `'application/x-www-form-urlencoded; charset=utf-8'`
133 - if not given and there is a `body`)
134 -- `headers['Date']` (used to calculate the signature date if given, otherwise `new Date` is used)
135 -
136 -Your AWS credentials (which can be found in your
137 -[AWS console](https://portal.aws.amazon.com/gp/aws/securityCredentials))
138 -can be specified in one of two ways:
139 -
140 -- As the second argument, like this:
141 -
142 -```javascript
143 -aws4.sign(requestOptions, {
144 - secretAccessKey: "<your-secret-access-key>",
145 - accessKeyId: "<your-access-key-id>",
146 - sessionToken: "<your-session-token>"
147 -})
148 -```
149 -
150 -- From `process.env`, such as this:
151 -
152 -```
153 -export AWS_ACCESS_KEY_ID="<your-access-key-id>"
154 -export AWS_SECRET_ACCESS_KEY="<your-secret-access-key>"
155 -export AWS_SESSION_TOKEN="<your-session-token>"
156 -```
157 -
158 -(will also use `AWS_ACCESS_KEY` and `AWS_SECRET_KEY` if available)
159 -
160 -The `sessionToken` property and `AWS_SESSION_TOKEN` environment variable are optional for signing
161 -with [IAM STS temporary credentials](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_use-resources.html).
162 -
163 -Installation
164 -------------
165 -
166 -With [npm](https://www.npmjs.com/) do:
167 -
168 -```
169 -npm install aws4
170 -```
171 -
172 -Can also be used [in the browser](./browser).
173 -
174 -Thanks
175 -------
176 -
177 -Thanks to [@jed](https://github.com/jed) for his
178 -[dynamo-client](https://github.com/jed/dynamo-client) lib where I first
179 -committed and subsequently extracted this code.
180 -
181 -Also thanks to the
182 -[official Node.js AWS SDK](https://github.com/aws/aws-sdk-js) for giving
183 -me a start on implementing the v4 signature.
1 -module.exports = function(size) {
2 - return new LruCache(size)
3 -}
4 -
5 -function LruCache(size) {
6 - this.capacity = size | 0
7 - this.map = Object.create(null)
8 - this.list = new DoublyLinkedList()
9 -}
10 -
11 -LruCache.prototype.get = function(key) {
12 - var node = this.map[key]
13 - if (node == null) return undefined
14 - this.used(node)
15 - return node.val
16 -}
17 -
18 -LruCache.prototype.set = function(key, val) {
19 - var node = this.map[key]
20 - if (node != null) {
21 - node.val = val
22 - } else {
23 - if (!this.capacity) this.prune()
24 - if (!this.capacity) return false
25 - node = new DoublyLinkedNode(key, val)
26 - this.map[key] = node
27 - this.capacity--
28 - }
29 - this.used(node)
30 - return true
31 -}
32 -
33 -LruCache.prototype.used = function(node) {
34 - this.list.moveToFront(node)
35 -}
36 -
37 -LruCache.prototype.prune = function() {
38 - var node = this.list.pop()
39 - if (node != null) {
40 - delete this.map[node.key]
41 - this.capacity++
42 - }
43 -}
44 -
45 -
46 -function DoublyLinkedList() {
47 - this.firstNode = null
48 - this.lastNode = null
49 -}
50 -
51 -DoublyLinkedList.prototype.moveToFront = function(node) {
52 - if (this.firstNode == node) return
53 -
54 - this.remove(node)
55 -
56 - if (this.firstNode == null) {
57 - this.firstNode = node
58 - this.lastNode = node
59 - node.prev = null
60 - node.next = null
61 - } else {
62 - node.prev = null
63 - node.next = this.firstNode
64 - node.next.prev = node
65 - this.firstNode = node
66 - }
67 -}
68 -
69 -DoublyLinkedList.prototype.pop = function() {
70 - var lastNode = this.lastNode
71 - if (lastNode != null) {
72 - this.remove(lastNode)
73 - }
74 - return lastNode
75 -}
76 -
77 -DoublyLinkedList.prototype.remove = function(node) {
78 - if (this.firstNode == node) {
79 - this.firstNode = node.next
80 - } else if (node.prev != null) {
81 - node.prev.next = node.next
82 - }
83 - if (this.lastNode == node) {
84 - this.lastNode = node.prev
85 - } else if (node.next != null) {
86 - node.next.prev = node.prev
87 - }
88 -}
89 -
90 -
91 -function DoublyLinkedNode(key, val) {
92 - this.key = key
93 - this.val = val
94 - this.prev = null
95 - this.next = null
96 -}
1 -{
2 - "name": "aws4",
3 - "version": "1.11.0",
4 - "description": "Signs and prepares requests using AWS Signature Version 4",
5 - "author": "Michael Hart <michael.hart.au@gmail.com> (https://github.com/mhart)",
6 - "license": "MIT",
7 - "repository": "github:mhart/aws4",
8 - "main": "aws4.js",
9 - "scripts": {
10 - "test": "mocha ./test/fast.js -R list",
11 - "integration": "node ./test/slow.js"
12 - },
13 - "devDependencies": {
14 - "mocha": "^2.5.3",
15 - "should": "^8.4.0"
16 - }
17 -}
1 -tidelift: "npm/balanced-match"
2 -patreon: juliangruber
1 -(MIT)
2 -
3 -Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
4 -
5 -Permission is hereby granted, free of charge, to any person obtaining a copy of
6 -this software and associated documentation files (the "Software"), to deal in
7 -the Software without restriction, including without limitation the rights to
8 -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
9 -of the Software, and to permit persons to whom the Software is furnished to do
10 -so, subject to the following conditions:
11 -
12 -The above copyright notice and this permission notice shall be included in all
13 -copies or substantial portions of the Software.
14 -
15 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 -SOFTWARE.
1 -# balanced-match
2 -
3 -Match balanced string pairs, like `{` and `}` or `<b>` and `</b>`. Supports regular expressions as well!
4 -
5 -[![build status](https://secure.travis-ci.org/juliangruber/balanced-match.svg)](http://travis-ci.org/juliangruber/balanced-match)
6 -[![downloads](https://img.shields.io/npm/dm/balanced-match.svg)](https://www.npmjs.org/package/balanced-match)
7 -
8 -[![testling badge](https://ci.testling.com/juliangruber/balanced-match.png)](https://ci.testling.com/juliangruber/balanced-match)
9 -
10 -## Example
11 -
12 -Get the first matching pair of braces:
13 -
14 -```js
15 -var balanced = require('balanced-match');
16 -
17 -console.log(balanced('{', '}', 'pre{in{nested}}post'));
18 -console.log(balanced('{', '}', 'pre{first}between{second}post'));
19 -console.log(balanced(/\s+\{\s+/, /\s+\}\s+/, 'pre { in{nest} } post'));
20 -```
21 -
22 -The matches are:
23 -
24 -```bash
25 -$ node example.js
26 -{ start: 3, end: 14, pre: 'pre', body: 'in{nested}', post: 'post' }
27 -{ start: 3,
28 - end: 9,
29 - pre: 'pre',
30 - body: 'first',
31 - post: 'between{second}post' }
32 -{ start: 3, end: 17, pre: 'pre', body: 'in{nest}', post: 'post' }
33 -```
34 -
35 -## API
36 -
37 -### var m = balanced(a, b, str)
38 -
39 -For the first non-nested matching pair of `a` and `b` in `str`, return an
40 -object with those keys:
41 -
42 -* **start** the index of the first match of `a`
43 -* **end** the index of the matching `b`
44 -* **pre** the preamble, `a` and `b` not included
45 -* **body** the match, `a` and `b` not included
46 -* **post** the postscript, `a` and `b` not included
47 -
48 -If there's no match, `undefined` will be returned.
49 -
50 -If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `['{', 'a', '']` and `{a}}` will match `['', 'a', '}']`.
51 -
52 -### var r = balanced.range(a, b, str)
53 -
54 -For the first non-nested matching pair of `a` and `b` in `str`, return an
55 -array with indexes: `[ <a index>, <b index> ]`.
56 -
57 -If there's no match, `undefined` will be returned.
58 -
59 -If the `str` contains more `a` than `b` / there are unmatched pairs, the first match that was closed will be used. For example, `{{a}` will match `[ 1, 3 ]` and `{a}}` will match `[0, 2]`.
60 -
61 -## Installation
62 -
63 -With [npm](https://npmjs.org) do:
64 -
65 -```bash
66 -npm install balanced-match
67 -```
68 -
69 -## Security contact information
70 -
71 -To report a security vulnerability, please use the
72 -[Tidelift security contact](https://tidelift.com/security).
73 -Tidelift will coordinate the fix and disclosure.
74 -
75 -## License
76 -
77 -(MIT)
78 -
79 -Copyright (c) 2013 Julian Gruber &lt;julian@juliangruber.com&gt;
80 -
81 -Permission is hereby granted, free of charge, to any person obtaining a copy of
82 -this software and associated documentation files (the "Software"), to deal in
83 -the Software without restriction, including without limitation the rights to
84 -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
85 -of the Software, and to permit persons to whom the Software is furnished to do
86 -so, subject to the following conditions:
87 -
88 -The above copyright notice and this permission notice shall be included in all
89 -copies or substantial portions of the Software.
90 -
91 -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
92 -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
93 -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
94 -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
95 -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
96 -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
97 -SOFTWARE.
1 -'use strict';
2 -module.exports = balanced;
3 -function balanced(a, b, str) {
4 - if (a instanceof RegExp) a = maybeMatch(a, str);
5 - if (b instanceof RegExp) b = maybeMatch(b, str);
6 -
7 - var r = range(a, b, str);
8 -
9 - return r && {
10 - start: r[0],
11 - end: r[1],
12 - pre: str.slice(0, r[0]),
13 - body: str.slice(r[0] + a.length, r[1]),
14 - post: str.slice(r[1] + b.length)
15 - };
16 -}
17 -
18 -function maybeMatch(reg, str) {
19 - var m = str.match(reg);
20 - return m ? m[0] : null;
21 -}
22 -
23 -balanced.range = range;
24 -function range(a, b, str) {
25 - var begs, beg, left, right, result;
26 - var ai = str.indexOf(a);
27 - var bi = str.indexOf(b, ai + 1);
28 - var i = ai;
29 -
30 - if (ai >= 0 && bi > 0) {
31 - if(a===b) {
32 - return [ai, bi];
33 - }
34 - begs = [];
35 - left = str.length;
36 -
37 - while (i >= 0 && !result) {
38 - if (i == ai) {
39 - begs.push(i);
40 - ai = str.indexOf(a, i + 1);
41 - } else if (begs.length == 1) {
42 - result = [ begs.pop(), bi ];
43 - } else {
44 - beg = begs.pop();
45 - if (beg < left) {
46 - left = beg;
47 - right = bi;
48 - }
49 -
50 - bi = str.indexOf(b, i + 1);
51 - }
52 -
53 - i = ai < bi && ai >= 0 ? ai : bi;
54 - }
55 -
56 - if (begs.length) {
57 - result = [ left, right ];
58 - }
59 - }
60 -
61 - return result;
62 -}
1 -{
2 - "name": "balanced-match",
3 - "description": "Match balanced character pairs, like \"{\" and \"}\"",
4 - "version": "1.0.2",
5 - "repository": {
6 - "type": "git",
7 - "url": "git://github.com/juliangruber/balanced-match.git"
8 - },
9 - "homepage": "https://github.com/juliangruber/balanced-match",
10 - "main": "index.js",
11 - "scripts": {
12 - "test": "tape test/test.js",
13 - "bench": "matcha test/bench.js"
14 - },
15 - "devDependencies": {
16 - "matcha": "^0.7.0",
17 - "tape": "^4.6.0"
18 - },
19 - "keywords": [
20 - "match",
21 - "regexp",
22 - "test",
23 - "balanced",
24 - "parse"
25 - ],
26 - "author": {
27 - "name": "Julian Gruber",
28 - "email": "mail@juliangruber.com",
29 - "url": "http://juliangruber.com"
30 - },
31 - "license": "MIT",
32 - "testling": {
33 - "files": "test/*.js",
34 - "browsers": [
35 - "ie/8..latest",
36 - "firefox/20..latest",
37 - "firefox/nightly",
38 - "chrome/25..latest",
39 - "chrome/canary",
40 - "opera/12..latest",
41 - "opera/next",
42 - "safari/5.1..latest",
43 - "ipad/6.0..latest",
44 - "iphone/6.0..latest",
45 - "android-browser/4.2..latest"
46 - ]
47 - }
48 -}
1 -# Contributing
2 -
3 -This repository uses [cr.joyent.us](https://cr.joyent.us) (Gerrit) for new
4 -changes. Anyone can submit changes. To get started, see the [cr.joyent.us user
5 -guide](https://github.com/joyent/joyent-gerrit/blob/master/docs/user/README.md).
6 -This repo does not use GitHub pull requests.
7 -
8 -See the [Joyent Engineering
9 -Guidelines](https://github.com/joyent/eng/blob/master/docs/index.md) for general
10 -best practices expected in this repository.
11 -
12 -If you're changing something non-trivial or user-facing, you may want to submit
13 -an issue first.
1 -The Blowfish portions are under the following license:
2 -
3 -Blowfish block cipher for OpenBSD
4 -Copyright 1997 Niels Provos <provos@physnet.uni-hamburg.de>
5 -All rights reserved.
6 -
7 -Implementation advice by David Mazieres <dm@lcs.mit.edu>.
8 -
9 -Redistribution and use in source and binary forms, with or without
10 -modification, are permitted provided that the following conditions
11 -are met:
12 -1. Redistributions of source code must retain the above copyright
13 - notice, this list of conditions and the following disclaimer.
14 -2. Redistributions in binary form must reproduce the above copyright
15 - notice, this list of conditions and the following disclaimer in the
16 - documentation and/or other materials provided with the distribution.
17 -3. The name of the author may not be used to endorse or promote products
18 - derived from this software without specific prior written permission.
19 -
20 -THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
21 -IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22 -OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23 -IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 -INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 -NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 -DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 -THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 -(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 -THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 -
31 -
32 -
33 -The bcrypt_pbkdf portions are under the following license:
34 -
35 -Copyright (c) 2013 Ted Unangst <tedu@openbsd.org>
36 -
37 -Permission to use, copy, modify, and distribute this software for any
38 -purpose with or without fee is hereby granted, provided that the above
39 -copyright notice and this permission notice appear in all copies.
40 -
41 -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
42 -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
43 -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
44 -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
45 -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
46 -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
47 -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
48 -
49 -
50 -
51 -Performance improvements (Javascript-specific):
52 -
53 -Copyright 2016, Joyent Inc
54 -Author: Alex Wilson <alex.wilson@joyent.com>
55 -
56 -Permission to use, copy, modify, and distribute this software for any
57 -purpose with or without fee is hereby granted, provided that the above
58 -copyright notice and this permission notice appear in all copies.
59 -
60 -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
61 -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
62 -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
63 -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
64 -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
65 -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
66 -OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1 -Port of the OpenBSD `bcrypt_pbkdf` function to pure Javascript. `npm`-ified
2 -version of [Devi Mandiri's port](https://github.com/devi/tmp/blob/master/js/bcrypt_pbkdf.js),
3 -with some minor performance improvements. The code is copied verbatim (and
4 -un-styled) from Devi's work.
5 -
6 -This product includes software developed by Niels Provos.
7 -
8 -## API
9 -
10 -### `bcrypt_pbkdf.pbkdf(pass, passlen, salt, saltlen, key, keylen, rounds)`
11 -
12 -Derive a cryptographic key of arbitrary length from a given password and salt,
13 -using the OpenBSD `bcrypt_pbkdf` function. This is a combination of Blowfish and
14 -SHA-512.
15 -
16 -See [this article](http://www.tedunangst.com/flak/post/bcrypt-pbkdf) for
17 -further information.
18 -
19 -Parameters:
20 -
21 - * `pass`, a Uint8Array of length `passlen`
22 - * `passlen`, an integer Number
23 - * `salt`, a Uint8Array of length `saltlen`
24 - * `saltlen`, an integer Number
25 - * `key`, a Uint8Array of length `keylen`, will be filled with output
26 - * `keylen`, an integer Number
27 - * `rounds`, an integer Number, number of rounds of the PBKDF to run
28 -
29 -### `bcrypt_pbkdf.hash(sha2pass, sha2salt, out)`
30 -
31 -Calculate a Blowfish hash, given SHA2-512 output of a password and salt. Used as
32 -part of the inner round function in the PBKDF.
33 -
34 -Parameters:
35 -
36 - * `sha2pass`, a Uint8Array of length 64
37 - * `sha2salt`, a Uint8Array of length 64
38 - * `out`, a Uint8Array of length 32, will be filled with output
39 -
40 -## License
41 -
42 -This source form is a 1:1 port from the OpenBSD `blowfish.c` and `bcrypt_pbkdf.c`.
43 -As a result, it retains the original copyright and license. The two files are
44 -under slightly different (but compatible) licenses, and are here combined in
45 -one file. For each of the full license texts see `LICENSE`.
1 -(The MIT License)
2 -
3 -Copyright (c) 2014 Jonathan Ong <me@jongleberry.com>
4 -Copyright (c) 2014-2015 Douglas Christopher Wilson <doug@somethingdoug.com>
5 -
6 -Permission is hereby granted, free of charge, to any person obtaining
7 -a copy of this software and associated documentation files (the
8 -'Software'), to deal in the Software without restriction, including
9 -without limitation the rights to use, copy, modify, merge, publish,
10 -distribute, sublicense, and/or sell copies of the Software, and to
11 -permit persons to whom the Software is furnished to do so, subject to
12 -the following conditions:
13 -
14 -The above copyright notice and this permission notice shall be
15 -included in all copies or substantial portions of the Software.
16 -
17 -THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
18 -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
21 -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
22 -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
23 -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1 -# Security Policies and Procedures
2 -
3 -## Reporting a Bug
4 -
5 -The Express team and community take all security bugs seriously. Thank you
6 -for improving the security of Express. We appreciate your efforts and
7 -responsible disclosure and will make every effort to acknowledge your
8 -contributions.
9 -
10 -Report security bugs by emailing the current owner(s) of `body-parser`. This
11 -information can be found in the npm registry using the command
12 -`npm owner ls body-parser`.
13 -If unsure or unable to get the information from the above, open an issue
14 -in the [project issue tracker](https://github.com/expressjs/body-parser/issues)
15 -asking for the current contact information.
16 -
17 -To ensure the timely response to your report, please ensure that the entirety
18 -of the report is contained within the email body and not solely behind a web
19 -link or an attachment.
20 -
21 -At least one owner will acknowledge your email within 48 hours, and will send a
22 -more detailed response within 48 hours indicating the next steps in handling
23 -your report. After the initial reply to your report, the owners will
24 -endeavor to keep you informed of the progress towards a fix and full
25 -announcement, and may ask for additional information or guidance.
1 -/*!
2 - * body-parser
3 - * Copyright(c) 2014-2015 Douglas Christopher Wilson
4 - * MIT Licensed
5 - */
6 -
7 -'use strict'
8 -
9 -/**
10 - * Module dependencies.
11 - * @private
12 - */
13 -
14 -var deprecate = require('depd')('body-parser')
15 -
16 -/**
17 - * Cache of loaded parsers.
18 - * @private
19 - */
20 -
21 -var parsers = Object.create(null)
22 -
23 -/**
24 - * @typedef Parsers
25 - * @type {function}
26 - * @property {function} json
27 - * @property {function} raw
28 - * @property {function} text
29 - * @property {function} urlencoded
30 - */
31 -
32 -/**
33 - * Module exports.
34 - * @type {Parsers}
35 - */
36 -
37 -exports = module.exports = deprecate.function(bodyParser,
38 - 'bodyParser: use individual json/urlencoded middlewares')
39 -
40 -/**
41 - * JSON parser.
42 - * @public
43 - */
44 -
45 -Object.defineProperty(exports, 'json', {
46 - configurable: true,
47 - enumerable: true,
48 - get: createParserGetter('json')
49 -})
50 -
51 -/**
52 - * Raw parser.
53 - * @public
54 - */
55 -
56 -Object.defineProperty(exports, 'raw', {
57 - configurable: true,
58 - enumerable: true,
59 - get: createParserGetter('raw')
60 -})
61 -
62 -/**
63 - * Text parser.
64 - * @public
65 - */
66 -
67 -Object.defineProperty(exports, 'text', {
68 - configurable: true,
69 - enumerable: true,
70 - get: createParserGetter('text')
71 -})
72 -
73 -/**
74 - * URL-encoded parser.
75 - * @public
76 - */
77 -
78 -Object.defineProperty(exports, 'urlencoded', {
79 - configurable: true,
80 - enumerable: true,
81 - get: createParserGetter('urlencoded')
82 -})
83 -
84 -/**
85 - * Create a middleware to parse json and urlencoded bodies.
86 - *
87 - * @param {object} [options]
88 - * @return {function}
89 - * @deprecated
90 - * @public
91 - */
92 -
93 -function bodyParser (options) {
94 - var opts = {}
95 -
96 - // exclude type option
97 - if (options) {
98 - for (var prop in options) {
99 - if (prop !== 'type') {
100 - opts[prop] = options[prop]
101 - }
102 - }
103 - }
104 -
105 - var _urlencoded = exports.urlencoded(opts)
106 - var _json = exports.json(opts)
107 -
108 - return function bodyParser (req, res, next) {
109 - _json(req, res, function (err) {
110 - if (err) return next(err)
111 - _urlencoded(req, res, next)
112 - })
113 - }
114 -}
115 -
116 -/**
117 - * Create a getter for loading a parser.
118 - * @private
119 - */
120 -
121 -function createParserGetter (name) {
122 - return function get () {
123 - return loadParser(name)
124 - }
125 -}
126 -
127 -/**
128 - * Load a parser module.
129 - * @private
130 - */
131 -
132 -function loadParser (parserName) {
133 - var parser = parsers[parserName]
134 -
135 - if (parser !== undefined) {
136 - return parser
137 - }
138 -
139 - // this uses a switch for static require analysis
140 - switch (parserName) {
141 - case 'json':
142 - parser = require('./lib/types/json')
143 - break
144 - case 'raw':
145 - parser = require('./lib/types/raw')
146 - break
147 - case 'text':
148 - parser = require('./lib/types/text')
149 - break
150 - case 'urlencoded':
151 - parser = require('./lib/types/urlencoded')
152 - break
153 - }
154 -
155 - // store to prevent invoking require()
156 - return (parsers[parserName] = parser)
157 -}
1 -/*!
2 - * body-parser
3 - * Copyright(c) 2014-2015 Douglas Christopher Wilson
4 - * MIT Licensed
5 - */
6 -
7 -'use strict'
8 -
9 -/**
10 - * Module dependencies.
11 - * @private
12 - */
13 -
14 -var createError = require('http-errors')
15 -var destroy = require('destroy')
16 -var getBody = require('raw-body')
17 -var iconv = require('iconv-lite')
18 -var onFinished = require('on-finished')
19 -var unpipe = require('unpipe')
20 -var zlib = require('zlib')
21 -
22 -/**
23 - * Module exports.
24 - */
25 -
26 -module.exports = read
27 -
28 -/**
29 - * Read a request into a buffer and parse.
30 - *
31 - * @param {object} req
32 - * @param {object} res
33 - * @param {function} next
34 - * @param {function} parse
35 - * @param {function} debug
36 - * @param {object} options
37 - * @private
38 - */
39 -
40 -function read (req, res, next, parse, debug, options) {
41 - var length
42 - var opts = options
43 - var stream
44 -
45 - // flag as parsed
46 - req._body = true
47 -
48 - // read options
49 - var encoding = opts.encoding !== null
50 - ? opts.encoding
51 - : null
52 - var verify = opts.verify
53 -
54 - try {
55 - // get the content stream
56 - stream = contentstream(req, debug, opts.inflate)
57 - length = stream.length
58 - stream.length = undefined
59 - } catch (err) {
60 - return next(err)
61 - }
62 -
63 - // set raw-body options
64 - opts.length = length
65 - opts.encoding = verify
66 - ? null
67 - : encoding
68 -
69 - // assert charset is supported
70 - if (opts.encoding === null && encoding !== null && !iconv.encodingExists(encoding)) {
71 - return next(createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
72 - charset: encoding.toLowerCase(),
73 - type: 'charset.unsupported'
74 - }))
75 - }
76 -
77 - // read body
78 - debug('read body')
79 - getBody(stream, opts, function (error, body) {
80 - if (error) {
81 - var _error
82 -
83 - if (error.type === 'encoding.unsupported') {
84 - // echo back charset
85 - _error = createError(415, 'unsupported charset "' + encoding.toUpperCase() + '"', {
86 - charset: encoding.toLowerCase(),
87 - type: 'charset.unsupported'
88 - })
89 - } else {
90 - // set status code on error
91 - _error = createError(400, error)
92 - }
93 -
94 - // unpipe from stream and destroy
95 - if (stream !== req) {
96 - unpipe(req)
97 - destroy(stream, true)
98 - }
99 -
100 - // read off entire request
101 - dump(req, function onfinished () {
102 - next(createError(400, _error))
103 - })
104 - return
105 - }
106 -
107 - // verify
108 - if (verify) {
109 - try {
110 - debug('verify body')
111 - verify(req, res, body, encoding)
112 - } catch (err) {
113 - next(createError(403, err, {
114 - body: body,
115 - type: err.type || 'entity.verify.failed'
116 - }))
117 - return
118 - }
119 - }
120 -
121 - // parse
122 - var str = body
123 - try {
124 - debug('parse body')
125 - str = typeof body !== 'string' && encoding !== null
126 - ? iconv.decode(body, encoding)
127 - : body
128 - req.body = parse(str)
129 - } catch (err) {
130 - next(createError(400, err, {
131 - body: str,
132 - type: err.type || 'entity.parse.failed'
133 - }))
134 - return
135 - }
136 -
137 - next()
138 - })
139 -}
140 -
141 -/**
142 - * Get the content stream of the request.
143 - *
144 - * @param {object} req
145 - * @param {function} debug
146 - * @param {boolean} [inflate=true]
147 - * @return {object}
148 - * @api private
149 - */
150 -
151 -function contentstream (req, debug, inflate) {
152 - var encoding = (req.headers['content-encoding'] || 'identity').toLowerCase()
153 - var length = req.headers['content-length']
154 - var stream
155 -
156 - debug('content-encoding "%s"', encoding)
157 -
158 - if (inflate === false && encoding !== 'identity') {
159 - throw createError(415, 'content encoding unsupported', {
160 - encoding: encoding,
161 - type: 'encoding.unsupported'
162 - })
163 - }
164 -
165 - switch (encoding) {
166 - case 'deflate':
167 - stream = zlib.createInflate()
168 - debug('inflate body')
169 - req.pipe(stream)
170 - break
171 - case 'gzip':
172 - stream = zlib.createGunzip()
173 - debug('gunzip body')
174 - req.pipe(stream)
175 - break
176 - case 'identity':
177 - stream = req
178 - stream.length = length
179 - break
180 - default:
181 - throw createError(415, 'unsupported content encoding "' + encoding + '"', {
182 - encoding: encoding,
183 - type: 'encoding.unsupported'
184 - })
185 - }
186 -
187 - return stream
188 -}
189 -
190 -/**
191 - * Dump the contents of a request.
192 - *
193 - * @param {object} req
194 - * @param {function} callback
195 - * @api private
196 - */
197 -
198 -function dump (req, callback) {
199 - if (onFinished.isFinished(req)) {
200 - callback(null)
201 - } else {
202 - onFinished(req, callback)
203 - req.resume()
204 - }
205 -}
1 -/*!
2 - * body-parser
3 - * Copyright(c) 2014 Jonathan Ong
4 - * Copyright(c) 2014-2015 Douglas Christopher Wilson
5 - * MIT Licensed
6 - */
7 -
8 -'use strict'
9 -
10 -/**
11 - * Module dependencies.
12 - * @private
13 - */
14 -
15 -var bytes = require('bytes')
16 -var contentType = require('content-type')
17 -var createError = require('http-errors')
18 -var debug = require('debug')('body-parser:json')
19 -var read = require('../read')
20 -var typeis = require('type-is')
21 -
22 -/**
23 - * Module exports.
24 - */
25 -
26 -module.exports = json
27 -
28 -/**
29 - * RegExp to match the first non-space in a string.
30 - *
31 - * Allowed whitespace is defined in RFC 7159:
32 - *
33 - * ws = *(
34 - * %x20 / ; Space
35 - * %x09 / ; Horizontal tab
36 - * %x0A / ; Line feed or New line
37 - * %x0D ) ; Carriage return
38 - */
39 -
40 -var FIRST_CHAR_REGEXP = /^[\x20\x09\x0a\x0d]*([^\x20\x09\x0a\x0d])/ // eslint-disable-line no-control-regex
41 -
42 -/**
43 - * Create a middleware to parse JSON bodies.
44 - *
45 - * @param {object} [options]
46 - * @return {function}
47 - * @public
48 - */
49 -
50 -function json (options) {
51 - var opts = options || {}
52 -
53 - var limit = typeof opts.limit !== 'number'
54 - ? bytes.parse(opts.limit || '100kb')
55 - : opts.limit
56 - var inflate = opts.inflate !== false
57 - var reviver = opts.reviver
58 - var strict = opts.strict !== false
59 - var type = opts.type || 'application/json'
60 - var verify = opts.verify || false
61 -
62 - if (verify !== false && typeof verify !== 'function') {
63 - throw new TypeError('option verify must be function')
64 - }
65 -
66 - // create the appropriate type checking function
67 - var shouldParse = typeof type !== 'function'
68 - ? typeChecker(type)
69 - : type
70 -
71 - function parse (body) {
72 - if (body.length === 0) {
73 - // special-case empty json body, as it's a common client-side mistake
74 - // TODO: maybe make this configurable or part of "strict" option
75 - return {}
76 - }
77 -
78 - if (strict) {
79 - var first = firstchar(body)
80 -
81 - if (first !== '{' && first !== '[') {
82 - debug('strict violation')
83 - throw createStrictSyntaxError(body, first)
84 - }
85 - }
86 -
87 - try {
88 - debug('parse json')
89 - return JSON.parse(body, reviver)
90 - } catch (e) {
91 - throw normalizeJsonSyntaxError(e, {
92 - message: e.message,
93 - stack: e.stack
94 - })
95 - }
96 - }
97 -
98 - return function jsonParser (req, res, next) {
99 - if (req._body) {
100 - debug('body already parsed')
101 - next()
102 - return
103 - }
104 -
105 - req.body = req.body || {}
106 -
107 - // skip requests without bodies
108 - if (!typeis.hasBody(req)) {
109 - debug('skip empty body')
110 - next()
111 - return
112 - }
113 -
114 - debug('content-type %j', req.headers['content-type'])
115 -
116 - // determine if request should be parsed
117 - if (!shouldParse(req)) {
118 - debug('skip parsing')
119 - next()
120 - return
121 - }
122 -
123 - // assert charset per RFC 7159 sec 8.1
124 - var charset = getCharset(req) || 'utf-8'
125 - if (charset.slice(0, 4) !== 'utf-') {
126 - debug('invalid charset')
127 - next(createError(415, 'unsupported charset "' + charset.toUpperCase() + '"', {
128 - charset: charset,
129 - type: 'charset.unsupported'
130 - }))
131 - return
132 - }
133 -
134 - // read
135 - read(req, res, next, parse, debug, {
136 - encoding: charset,
137 - inflate: inflate,
138 - limit: limit,
139 - verify: verify
140 - })
141 - }
142 -}
143 -
144 -/**
145 - * Create strict violation syntax error matching native error.
146 - *
147 - * @param {string} str
148 - * @param {string} char
149 - * @return {Error}
150 - * @private
151 - */
152 -
153 -function createStrictSyntaxError (str, char) {
154 - var index = str.indexOf(char)
155 - var partial = index !== -1
156 - ? str.substring(0, index) + '#'
157 - : ''
158 -
159 - try {
160 - JSON.parse(partial); /* istanbul ignore next */ throw new SyntaxError('strict violation')
161 - } catch (e) {
162 - return normalizeJsonSyntaxError(e, {
163 - message: e.message.replace('#', char),
164 - stack: e.stack
165 - })
166 - }
167 -}
168 -
169 -/**
170 - * Get the first non-whitespace character in a string.
171 - *
172 - * @param {string} str
173 - * @return {function}
174 - * @private
175 - */
176 -
177 -function firstchar (str) {
178 - var match = FIRST_CHAR_REGEXP.exec(str)
179 -
180 - return match
181 - ? match[1]
182 - : undefined
183 -}
184 -
185 -/**
186 - * Get the charset of a request.
187 - *
188 - * @param {object} req
189 - * @api private
190 - */
191 -
192 -function getCharset (req) {
193 - try {
194 - return (contentType.parse(req).parameters.charset || '').toLowerCase()
195 - } catch (e) {
196 - return undefined
197 - }
198 -}
199 -
200 -/**
201 - * Normalize a SyntaxError for JSON.parse.
202 - *
203 - * @param {SyntaxError} error
204 - * @param {object} obj
205 - * @return {SyntaxError}
206 - */
207 -
208 -function normalizeJsonSyntaxError (error, obj) {
209 - var keys = Object.getOwnPropertyNames(error)
210 -
211 - for (var i = 0; i < keys.length; i++) {
212 - var key = keys[i]
213 - if (key !== 'stack' && key !== 'message') {
214 - delete error[key]
215 - }
216 - }
217 -
218 - // replace stack before message for Node.js 0.10 and below
219 - error.stack = obj.stack.replace(error.message, obj.message)
220 - error.message = obj.message
221 -
222 - return error
223 -}
224 -
225 -/**
226 - * Get the simple type checker.
227 - *
228 - * @param {string} type
229 - * @return {function}
230 - */
231 -
232 -function typeChecker (type) {
233 - return function checkType (req) {
234 - return Boolean(typeis(req, type))
235 - }
236 -}
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.
This diff is collapsed. Click to expand it.