wao 0.15.4 → 0.15.6

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.
package/cjs/utils.js CHANGED
@@ -294,11 +294,11 @@ var _getTagVal2 = function _getTagVal(get, res, from) {
294
294
  }
295
295
  } else {
296
296
  var _res$Messages2;
297
+ var i = 0;
297
298
  var _iterator5 = _createForOfIteratorHelper((_res$Messages2 = res.Messages) !== null && _res$Messages2 !== void 0 ? _res$Messages2 : []),
298
299
  _step5;
299
300
  try {
300
301
  for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
301
- var _v$Tags2;
302
302
  var v = _step5.value;
303
303
  if (_typeof(_get) === "object" && (0, _ramda.isNil)(_get.name) && (0, _ramda.isNil)(_get.data)) {
304
304
  _get.data = true;
@@ -310,7 +310,9 @@ var _getTagVal2 = function _getTagVal(get, res, from) {
310
310
  if (v.Data) out = v.Data;
311
311
  try {
312
312
  if (_get.json || _get === true) out = JSON.parse(out);
313
- } catch (e) {}
313
+ } catch (e) {
314
+ out = null;
315
+ }
314
316
  } else if (_typeof(_get) === "object" && typeof _get.name === "string") {
315
317
  var _v$Tags;
316
318
  var _from2 = null;
@@ -319,9 +321,18 @@ var _getTagVal2 = function _getTagVal(get, res, from) {
319
321
  out = getTag((_v$Tags = v.Tags) !== null && _v$Tags !== void 0 ? _v$Tags : [], _get.name);
320
322
  try {
321
323
  if (_get.json) out = JSON.parse(out);
322
- } catch (e) {}
323
- } else out = getTag((_v$Tags2 = v.Tags) !== null && _v$Tags2 !== void 0 ? _v$Tags2 : [], _get);
324
+ } catch (e) {
325
+ out = null;
326
+ }
327
+ } else {
328
+ var _v$Tags2;
329
+ out = getTag((_v$Tags2 = v.Tags) !== null && _v$Tags2 !== void 0 ? _v$Tags2 : [], _get);
330
+ }
331
+ if (out !== null && typeof _get.match === "function") {
332
+ if (!_get.match(out, i, res)) out = null;
333
+ }
324
334
  if (out) break;
335
+ i++;
325
336
  }
326
337
  } catch (err) {
327
338
  _iterator5.e(err);
package/esm/utils.js CHANGED
@@ -168,6 +168,7 @@ const _getTagVal = (get, res, from) => {
168
168
  out = {}
169
169
  for (const k in _get.obj ?? {}) out[k] = _getTagVal(_get.obj[k], res, from)
170
170
  } else {
171
+ let i = 0
171
172
  for (const v of res.Messages ?? []) {
172
173
  if (typeof _get === "object" && isNil(_get.name) && isNil(_get.data)) {
173
174
  _get.data = true
@@ -182,7 +183,9 @@ const _getTagVal = (get, res, from) => {
182
183
  if (v.Data) out = v.Data
183
184
  try {
184
185
  if (_get.json || _get === true) out = JSON.parse(out)
185
- } catch (e) {}
186
+ } catch (e) {
187
+ out = null
188
+ }
186
189
  } else if (typeof _get === "object" && typeof _get.name === "string") {
187
190
  let _from = null
188
191
  if (is(Object, _get) && _get.from) _from = _get.from
@@ -190,9 +193,17 @@ const _getTagVal = (get, res, from) => {
190
193
  out = getTag(v.Tags ?? [], _get.name)
191
194
  try {
192
195
  if (_get.json) out = JSON.parse(out)
193
- } catch (e) {}
194
- } else out = getTag(v.Tags ?? [], _get)
196
+ } catch (e) {
197
+ out = null
198
+ }
199
+ } else {
200
+ out = getTag(v.Tags ?? [], _get)
201
+ }
202
+ if (out !== null && typeof _get.match === "function") {
203
+ if (!_get.match(out, i, res)) out = null
204
+ }
195
205
  if (out) break
206
+ i++
196
207
  }
197
208
  }
198
209
  return out
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wao",
3
- "version": "0.15.4",
3
+ "version": "0.15.6",
4
4
  "bin": {
5
5
  "wao": "./cjs/cli.js",
6
6
  "wao-esm": "./esm/cli.js"