ig-types 6.24.9 → 6.24.10

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 +21 -19
  2. package/package.json +1 -1
package/Promise.js CHANGED
@@ -1048,37 +1048,39 @@ object.Mixin('PromiseMixin', 'soft', {
1048
1048
  cooperative: CooperativePromise,
1049
1049
  sync: SyncPromise,
1050
1050
  // XXX should this be implemented via SyncPromise???
1051
+ // XXX not sure if we need to expand async generators...
1051
1052
  awaitOrRun: function(data, func, error){
1052
1053
  data = [...arguments]
1053
1054
  func = data.pop()
1054
1055
  if(typeof(data.at(-1)) == 'function'){
1055
1056
  error = func
1056
1057
  func = data.pop() }
1057
- // ceck if we need to await...
1058
- return data
1059
- .reduce(function(res, e){
1058
+ error = error ?
1059
+ [error]
1060
+ : []
1061
+ // check if we need to await...
1062
+ return data.reduce(function(res, e){
1060
1063
  return res
1061
1064
  || e instanceof Promise }, false) ?
1062
- // NOTE: we will not reach this on empty data...
1063
- (data.length > 1 ?
1064
- Promise.all(data)
1065
- .then(
1066
- function(res){
1067
- return func(...res) },
1068
- ...(error ?
1069
- [error]
1070
- : []))
1071
- : data[0].then(
1072
- func,
1073
- ...(error ?
1074
- [error]
1075
- : [])))
1076
- : error ?
1065
+ // NOTE: we will not reach this on empty data...
1066
+ (data.length > 1 ?
1067
+ Promise.all(data)
1068
+ .then(
1069
+ function(res){
1070
+ return func(...res) },
1071
+ ...error)
1072
+ : data[0].then(func, ...error))
1073
+ // XXX not sure if we need to expand async generators...
1074
+ : (data.length == 1
1075
+ && Symbol.asyncIterator in data[0]
1076
+ && 'then' in data[0]) ?
1077
+ data[0].then(func, ...error)
1078
+ : error.length > 0 ?
1077
1079
  function(){
1078
1080
  try{
1079
1081
  return func(...data)
1080
1082
  }catch(err){
1081
- return error(err) } }()
1083
+ return error[0](err) } }()
1082
1084
  : func(...data) },
1083
1085
  })
1084
1086
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ig-types",
3
- "version": "6.24.9",
3
+ "version": "6.24.10",
4
4
  "description": "Generic JavaScript types and type extensions...",
5
5
  "main": "main.js",
6
6
  "scripts": {