ig-types 6.26.0 → 6.26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/Promise.js +16 -4
  2. package/package.json +1 -1
package/Promise.js CHANGED
@@ -1359,22 +1359,34 @@ object.Mixin('PromiseMixin', 'soft', {
1359
1359
 
1360
1360
  sync: SyncPromise,
1361
1361
 
1362
+ //
1363
+ // .awaitOrRun(<data>, .. , <func>)
1364
+ // .awaitOrRun(<data>, .. , <func>, <onerror>)
1365
+ // .awaitOrRun(<data>, .. , <func>, null)
1366
+ // -> <value>
1367
+ // -> <promise>
1368
+ //
1362
1369
  // XXX should this be implemented via SyncPromise???
1363
1370
  // XXX not sure if we need to expand async generators...
1364
1371
  // (update README if this changes)
1372
+ // XXX add ability to skip array internals checking...
1365
1373
  awaitOrRun: function(data, func, error){
1374
+ var mode = 'deep'
1366
1375
  data = [...arguments]
1367
1376
  func = data.pop()
1368
- if(typeof(data.at(-1)) == 'function'){
1377
+ if(data.length > 1
1378
+ && (typeof(data.at(-1)) == 'function'
1379
+ || func == null)){
1369
1380
  error = func
1370
1381
  func = data.pop() }
1371
1382
  error = error ?
1372
1383
  [error]
1373
1384
  : []
1374
1385
  // check if we need to await...
1375
- return data.reduce(function(res, e){
1376
- return res
1377
- || e instanceof Promise }, false) ?
1386
+ return (mode == 'deep'
1387
+ && data.reduce(function(res, e){
1388
+ return res
1389
+ || e instanceof Promise }, false)) ?
1378
1390
  // NOTE: we will not reach this on empty data...
1379
1391
  (data.length > 1 ?
1380
1392
  Promise.all(data)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ig-types",
3
- "version": "6.26.0",
3
+ "version": "6.26.1",
4
4
  "description": "Generic JavaScript types and type extensions...",
5
5
  "main": "main.js",
6
6
  "scripts": {