async-rails 2.5.0 → 2.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3167bb1ccee60605463aaf5db50d0e2fe48edd9a
4
- data.tar.gz: eae19d4f907e37cb0f58780ecdbfc2754d14f4d7
3
+ metadata.gz: 7422a10bacb2b5911ac920339f4e009cae5d3004
4
+ data.tar.gz: fe87d279a70fb7d0e0a55257f4d6b20bf5250afd
5
5
  SHA512:
6
- metadata.gz: bb2775a194cb58601b760323ae7d45b7bece32c5759a08c011817378db86cf16151605370c4679167b687de8bdb3c7ed8bdd8eddf98d25dab52cc3b05217d9bd
7
- data.tar.gz: af7fbf7fdef0619f84d290185b5cae511cc4a413dcc783dda6369c617714a5f49a6600a1f13914aeb1f54ca4bcd540e4835eae34f9bd7e89d7373afa910cf875
6
+ metadata.gz: 1a3de78198d696a3b92461e49c7485e79f5d0c2c613be0c969dfca80f8c5d5eea84c085980dee505f084c5401c5f2bd87cd58f987fb0c1588a4045eae3a531c8
7
+ data.tar.gz: 7e6d903409180d0639bc26ca495e1a0ddf9712b46914268af4fb03eee2540bcdd7da4a01d79e2809a01cd947e45f19bd8c4ab35d7d606c7652396441418db5c5
@@ -1,5 +1,5 @@
1
1
  module Async
2
2
  module Rails
3
- VERSION = "2.5.0"
3
+ VERSION = "2.6.0"
4
4
  end
5
5
  end
@@ -14,6 +14,59 @@ function slice(arrayLike, start) {
14
14
  return newArr;
15
15
  }
16
16
 
17
+ /**
18
+ * Creates a continuation function with some arguments already applied.
19
+ *
20
+ * Useful as a shorthand when combined with other control flow functions. Any
21
+ * arguments passed to the returned function are added to the arguments
22
+ * originally passed to apply.
23
+ *
24
+ * @name apply
25
+ * @static
26
+ * @memberOf module:Utils
27
+ * @method
28
+ * @category Util
29
+ * @param {Function} fn - The function you want to eventually apply all
30
+ * arguments to. Invokes with (arguments...).
31
+ * @param {...*} arguments... - Any number of arguments to automatically apply
32
+ * when the continuation is called.
33
+ * @returns {Function} the partially-applied function
34
+ * @example
35
+ *
36
+ * // using apply
37
+ * async.parallel([
38
+ * async.apply(fs.writeFile, 'testfile1', 'test1'),
39
+ * async.apply(fs.writeFile, 'testfile2', 'test2')
40
+ * ]);
41
+ *
42
+ *
43
+ * // the same process without using apply
44
+ * async.parallel([
45
+ * function(callback) {
46
+ * fs.writeFile('testfile1', 'test1', callback);
47
+ * },
48
+ * function(callback) {
49
+ * fs.writeFile('testfile2', 'test2', callback);
50
+ * }
51
+ * ]);
52
+ *
53
+ * // It's possible to pass any number of additional arguments when calling the
54
+ * // continuation:
55
+ *
56
+ * node> var fn = async.apply(sys.puts, 'one');
57
+ * node> fn('two', 'three');
58
+ * one
59
+ * two
60
+ * three
61
+ */
62
+ var apply = function(fn/*, ...args*/) {
63
+ var args = slice(arguments, 1);
64
+ return function(/*callArgs*/) {
65
+ var callArgs = slice(arguments);
66
+ return fn.apply(null, args.concat(callArgs));
67
+ };
68
+ };
69
+
17
70
  var initialParams = function (fn) {
18
71
  return function (/*...args, callback*/) {
19
72
  var args = slice(arguments);
@@ -291,8 +344,7 @@ function baseGetTag(value) {
291
344
  if (value == null) {
292
345
  return value === undefined ? undefinedTag : nullTag;
293
346
  }
294
- value = Object(value);
295
- return (symToStringTag && symToStringTag in value)
347
+ return (symToStringTag && symToStringTag in Object(value))
296
348
  ? getRawTag(value)
297
349
  : objectToString(value);
298
350
  }
@@ -701,7 +753,7 @@ var freeProcess = moduleExports$1 && freeGlobal.process;
701
753
  /** Used to access faster Node.js helpers. */
702
754
  var nodeUtil = (function() {
703
755
  try {
704
- return freeProcess && freeProcess.binding('util');
756
+ return freeProcess && freeProcess.binding && freeProcess.binding('util');
705
757
  } catch (e) {}
706
758
  }());
707
759
 
@@ -1216,59 +1268,6 @@ var mapSeries = doLimit(mapLimit, 1);
1216
1268
  */
1217
1269
  var applyEachSeries = applyEach$1(mapSeries);
1218
1270
 
1219
- /**
1220
- * Creates a continuation function with some arguments already applied.
1221
- *
1222
- * Useful as a shorthand when combined with other control flow functions. Any
1223
- * arguments passed to the returned function are added to the arguments
1224
- * originally passed to apply.
1225
- *
1226
- * @name apply
1227
- * @static
1228
- * @memberOf module:Utils
1229
- * @method
1230
- * @category Util
1231
- * @param {Function} fn - The function you want to eventually apply all
1232
- * arguments to. Invokes with (arguments...).
1233
- * @param {...*} arguments... - Any number of arguments to automatically apply
1234
- * when the continuation is called.
1235
- * @returns {Function} the partially-applied function
1236
- * @example
1237
- *
1238
- * // using apply
1239
- * async.parallel([
1240
- * async.apply(fs.writeFile, 'testfile1', 'test1'),
1241
- * async.apply(fs.writeFile, 'testfile2', 'test2')
1242
- * ]);
1243
- *
1244
- *
1245
- * // the same process without using apply
1246
- * async.parallel([
1247
- * function(callback) {
1248
- * fs.writeFile('testfile1', 'test1', callback);
1249
- * },
1250
- * function(callback) {
1251
- * fs.writeFile('testfile2', 'test2', callback);
1252
- * }
1253
- * ]);
1254
- *
1255
- * // It's possible to pass any number of additional arguments when calling the
1256
- * // continuation:
1257
- *
1258
- * node> var fn = async.apply(sys.puts, 'one');
1259
- * node> fn('two', 'three');
1260
- * one
1261
- * two
1262
- * three
1263
- */
1264
- var apply = function(fn/*, ...args*/) {
1265
- var args = slice(arguments, 1);
1266
- return function(/*callArgs*/) {
1267
- var callArgs = slice(arguments);
1268
- return fn.apply(null, args.concat(callArgs));
1269
- };
1270
- };
1271
-
1272
1271
  /**
1273
1272
  * A specialized version of `_.forEach` for arrays without support for
1274
1273
  * iteratee shorthands.
@@ -1823,15 +1822,17 @@ function asciiToArray(string) {
1823
1822
 
1824
1823
  /** Used to compose unicode character classes. */
1825
1824
  var rsAstralRange = '\\ud800-\\udfff';
1826
- var rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23';
1827
- var rsComboSymbolsRange = '\\u20d0-\\u20f0';
1825
+ var rsComboMarksRange = '\\u0300-\\u036f';
1826
+ var reComboHalfMarksRange = '\\ufe20-\\ufe2f';
1827
+ var rsComboSymbolsRange = '\\u20d0-\\u20ff';
1828
+ var rsComboRange = rsComboMarksRange + reComboHalfMarksRange + rsComboSymbolsRange;
1828
1829
  var rsVarRange = '\\ufe0e\\ufe0f';
1829
1830
 
1830
1831
  /** Used to compose unicode capture groups. */
1831
1832
  var rsZWJ = '\\u200d';
1832
1833
 
1833
1834
  /** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */
1834
- var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']');
1835
+ var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboRange + rsVarRange + ']');
1835
1836
 
1836
1837
  /**
1837
1838
  * Checks if `string` contains Unicode symbols.
@@ -1846,13 +1847,15 @@ function hasUnicode(string) {
1846
1847
 
1847
1848
  /** Used to compose unicode character classes. */
1848
1849
  var rsAstralRange$1 = '\\ud800-\\udfff';
1849
- var rsComboMarksRange$1 = '\\u0300-\\u036f\\ufe20-\\ufe23';
1850
- var rsComboSymbolsRange$1 = '\\u20d0-\\u20f0';
1850
+ var rsComboMarksRange$1 = '\\u0300-\\u036f';
1851
+ var reComboHalfMarksRange$1 = '\\ufe20-\\ufe2f';
1852
+ var rsComboSymbolsRange$1 = '\\u20d0-\\u20ff';
1853
+ var rsComboRange$1 = rsComboMarksRange$1 + reComboHalfMarksRange$1 + rsComboSymbolsRange$1;
1851
1854
  var rsVarRange$1 = '\\ufe0e\\ufe0f';
1852
1855
 
1853
1856
  /** Used to compose unicode capture groups. */
1854
1857
  var rsAstral = '[' + rsAstralRange$1 + ']';
1855
- var rsCombo = '[' + rsComboMarksRange$1 + rsComboSymbolsRange$1 + ']';
1858
+ var rsCombo = '[' + rsComboRange$1 + ']';
1856
1859
  var rsFitz = '\\ud83c[\\udffb-\\udfff]';
1857
1860
  var rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')';
1858
1861
  var rsNonAstral = '[^' + rsAstralRange$1 + ']';
@@ -2199,6 +2202,7 @@ function queue(worker, concurrency, payload) {
2199
2202
  var numRunning = 0;
2200
2203
  var workersList = [];
2201
2204
 
2205
+ var processingScheduled = false;
2202
2206
  function _insert(data, insertAtFront, callback) {
2203
2207
  if (callback != null && typeof callback !== 'function') {
2204
2208
  throw new Error('task callback must be a function');
@@ -2226,7 +2230,14 @@ function queue(worker, concurrency, payload) {
2226
2230
  q._tasks.push(item);
2227
2231
  }
2228
2232
  }
2229
- setImmediate$1(q.process);
2233
+
2234
+ if (!processingScheduled) {
2235
+ processingScheduled = true;
2236
+ setImmediate$1(function() {
2237
+ processingScheduled = false;
2238
+ q.process();
2239
+ });
2240
+ }
2230
2241
  }
2231
2242
 
2232
2243
  function _next(tasks) {
@@ -2237,7 +2248,9 @@ function queue(worker, concurrency, payload) {
2237
2248
  var task = tasks[i];
2238
2249
 
2239
2250
  var index = baseIndexOf(workersList, task, 0);
2240
- if (index >= 0) {
2251
+ if (index === 0) {
2252
+ workersList.shift();
2253
+ } else if (index > 0) {
2241
2254
  workersList.splice(index, 1);
2242
2255
  }
2243
2256
 
@@ -3804,7 +3817,7 @@ function memoize(fn, hasher) {
3804
3817
 
3805
3818
  /**
3806
3819
  * Calls `callback` on a later loop around the event loop. In Node.js this just
3807
- * calls `setImmediate`. In the browser it will use `setImmediate` if
3820
+ * calls `process.nextTicl`. In the browser it will use `setImmediate` if
3808
3821
  * available, otherwise `setTimeout(callback, 0)`, which means other higher
3809
3822
  * priority events may precede the execution of `callback`.
3810
3823
  *
@@ -3814,7 +3827,7 @@ function memoize(fn, hasher) {
3814
3827
  * @static
3815
3828
  * @memberOf module:Utils
3816
3829
  * @method
3817
- * @alias setImmediate
3830
+ * @see [async.setImmediate]{@link module:Utils.setImmediate}
3818
3831
  * @category Util
3819
3832
  * @param {Function} callback - The function to call on a later loop around
3820
3833
  * the event loop. Invoked with (args...).
@@ -4274,43 +4287,6 @@ function reflect(fn) {
4274
4287
  });
4275
4288
  }
4276
4289
 
4277
- function reject$1(eachfn, arr, iteratee, callback) {
4278
- _filter(eachfn, arr, function(value, cb) {
4279
- iteratee(value, function(err, v) {
4280
- cb(err, !v);
4281
- });
4282
- }, callback);
4283
- }
4284
-
4285
- /**
4286
- * The opposite of [`filter`]{@link module:Collections.filter}. Removes values that pass an `async` truth test.
4287
- *
4288
- * @name reject
4289
- * @static
4290
- * @memberOf module:Collections
4291
- * @method
4292
- * @see [async.filter]{@link module:Collections.filter}
4293
- * @category Collection
4294
- * @param {Array|Iterable|Object} coll - A collection to iterate over.
4295
- * @param {Function} iteratee - An async truth test to apply to each item in
4296
- * `coll`.
4297
- * The should complete with a boolean value as its `result`.
4298
- * Invoked with (item, callback).
4299
- * @param {Function} [callback] - A callback which is called after all the
4300
- * `iteratee` functions have finished. Invoked with (err, results).
4301
- * @example
4302
- *
4303
- * async.reject(['file1','file2','file3'], function(filePath, callback) {
4304
- * fs.access(filePath, function(err) {
4305
- * callback(null, !err)
4306
- * });
4307
- * }, function(err, results) {
4308
- * // results now equals an array of missing files
4309
- * createFiles(results);
4310
- * });
4311
- */
4312
- var reject = doParallel(reject$1);
4313
-
4314
4290
  /**
4315
4291
  * A helper function that wraps an array or an object of functions with `reflect`.
4316
4292
  *
@@ -4391,6 +4367,43 @@ function reflectAll(tasks) {
4391
4367
  return results;
4392
4368
  }
4393
4369
 
4370
+ function reject$1(eachfn, arr, iteratee, callback) {
4371
+ _filter(eachfn, arr, function(value, cb) {
4372
+ iteratee(value, function(err, v) {
4373
+ cb(err, !v);
4374
+ });
4375
+ }, callback);
4376
+ }
4377
+
4378
+ /**
4379
+ * The opposite of [`filter`]{@link module:Collections.filter}. Removes values that pass an `async` truth test.
4380
+ *
4381
+ * @name reject
4382
+ * @static
4383
+ * @memberOf module:Collections
4384
+ * @method
4385
+ * @see [async.filter]{@link module:Collections.filter}
4386
+ * @category Collection
4387
+ * @param {Array|Iterable|Object} coll - A collection to iterate over.
4388
+ * @param {Function} iteratee - An async truth test to apply to each item in
4389
+ * `coll`.
4390
+ * The should complete with a boolean value as its `result`.
4391
+ * Invoked with (item, callback).
4392
+ * @param {Function} [callback] - A callback which is called after all the
4393
+ * `iteratee` functions have finished. Invoked with (err, results).
4394
+ * @example
4395
+ *
4396
+ * async.reject(['file1','file2','file3'], function(filePath, callback) {
4397
+ * fs.access(filePath, function(err) {
4398
+ * callback(null, !err)
4399
+ * });
4400
+ * }, function(err, results) {
4401
+ * // results now equals an array of missing files
4402
+ * createFiles(results);
4403
+ * });
4404
+ */
4405
+ var reject = doParallel(reject$1);
4406
+
4394
4407
  /**
4395
4408
  * The same as [`reject`]{@link module:Collections.reject} but runs a maximum of `limit` async operations at a
4396
4409
  * time.
@@ -4530,8 +4543,8 @@ function constant$1(value) {
4530
4543
  * // do something with the result
4531
4544
  * });
4532
4545
  *
4533
- * // It can also be embedded within other control flow functions to retry
4534
- * // individual methods that are not as reliable, like this:
4546
+ * // to retry individual methods that are not as reliable within other
4547
+ * // control flow functions, use the `retryable` wrapper:
4535
4548
  * async.auto({
4536
4549
  * users: api.getUsers.bind(api),
4537
4550
  * payments: async.retryable(3, api.getPayments.bind(api))
@@ -5098,7 +5111,7 @@ function transform (coll, accumulator, iteratee, callback) {
5098
5111
  * `result` arguments of the last attempt at completing the `task`. Invoked with
5099
5112
  * (err, results).
5100
5113
  * @example
5101
- * async.try([
5114
+ * async.tryEach([
5102
5115
  * function getDataFromFirstWebsite(callback) {
5103
5116
  * // Try getting the data from the first website
5104
5117
  * callback(err, data);
@@ -5373,9 +5386,9 @@ var waterfall = function(tasks, callback) {
5373
5386
  */
5374
5387
 
5375
5388
  var index = {
5389
+ apply: apply,
5376
5390
  applyEach: applyEach,
5377
5391
  applyEachSeries: applyEachSeries,
5378
- apply: apply,
5379
5392
  asyncify: asyncify,
5380
5393
  auto: auto,
5381
5394
  autoInject: autoInject,
@@ -5453,7 +5466,14 @@ var index = {
5453
5466
 
5454
5467
  // aliases
5455
5468
  all: every,
5469
+ allLimit: everyLimit,
5470
+ allSeries: everySeries,
5456
5471
  any: some,
5472
+ anyLimit: someLimit,
5473
+ anySeries: someSeries,
5474
+ find: detect,
5475
+ findLimit: detectLimit,
5476
+ findSeries: detectSeries,
5457
5477
  forEach: eachLimit,
5458
5478
  forEachSeries: eachSeries,
5459
5479
  forEachLimit: eachLimit$1,
@@ -5470,9 +5490,9 @@ var index = {
5470
5490
  };
5471
5491
 
5472
5492
  exports['default'] = index;
5493
+ exports.apply = apply;
5473
5494
  exports.applyEach = applyEach;
5474
5495
  exports.applyEachSeries = applyEachSeries;
5475
- exports.apply = apply;
5476
5496
  exports.asyncify = asyncify;
5477
5497
  exports.auto = auto;
5478
5498
  exports.autoInject = autoInject;
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.0
4
+ version: 2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Chen
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2017-08-07 00:00:00.000000000 Z
12
+ date: 2017-11-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: railties
@@ -94,7 +94,7 @@ files:
94
94
  - lib/async-rails.rb
95
95
  - lib/async-rails/version.rb
96
96
  - vendor/assets/javascripts/async.js
97
- homepage: https://github.com/jhchen/async-rails
97
+ homepage: https://github.com/dbackowski/async-rails
98
98
  licenses: []
99
99
  metadata: {}
100
100
  post_install_message: