@ellipticltd/aml-utils 0.13.3-SCR-395 → 0.14.0

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 (39) hide show
  1. package/.nyc_output/6c9af0f1-e7f5-4521-8926-50f6385c07cf.json +1 -0
  2. package/.nyc_output/{9d699d3a-654b-4a19-911b-5f5a324954eb.json → a2931b0e-a917-4a52-a94d-88a1afc66ea7.json} +1 -1
  3. package/.nyc_output/processinfo/011c99ee-70e2-4785-ba07-3b5e1591b03b.json +1 -0
  4. package/.nyc_output/processinfo/5c634f75-5165-4488-a978-0129fbe23567.json +1 -0
  5. package/.nyc_output/processinfo/{bc8b1674-6bc0-41b1-9ecc-e743722f5e07.json → 6c9af0f1-e7f5-4521-8926-50f6385c07cf.json} +1 -1
  6. package/.nyc_output/processinfo/{9d699d3a-654b-4a19-911b-5f5a324954eb.json → a2931b0e-a917-4a52-a94d-88a1afc66ea7.json} +1 -1
  7. package/.nyc_output/processinfo/index.json +1 -1
  8. package/coverage/errors/errors.js.html +14 -14
  9. package/coverage/errors/errors.spec.js.html +14 -14
  10. package/coverage/errors/index.html +13 -13
  11. package/coverage/file-parser/__tests/file-parser.spec.js.html +63 -63
  12. package/coverage/file-parser/__tests/index.html +21 -21
  13. package/coverage/file-parser/__tests/parse-row.spec.js.html +12 -12
  14. package/coverage/file-parser/__tests/sanitize-rows.spec.js.html +17 -17
  15. package/coverage/formatting/formatting.js.html +6 -6
  16. package/coverage/formatting/formatting.spec.js.html +12 -12
  17. package/coverage/formatting/index.html +9 -9
  18. package/coverage/index.html +37 -37
  19. package/coverage/middleware/index.html +1 -1
  20. package/coverage/middleware/middleware.js.html +1 -1
  21. package/coverage/orm-helpers/index.html +9 -9
  22. package/coverage/orm-helpers/ormHelpers.js.html +5 -5
  23. package/coverage/orm-helpers/ormHelpers.spec.js.html +8 -8
  24. package/coverage/types/index.html +1 -1
  25. package/coverage/types/types.js.html +1 -1
  26. package/coverage/validations/index.html +27 -27
  27. package/coverage/validations/validations.js.html +129 -105
  28. package/coverage/validations/validations.spec.js.html +84 -84
  29. package/dist/index.js +0 -2
  30. package/dist/validations/validations.d.ts +6 -0
  31. package/dist/validations/validations.js +8 -0
  32. package/lib/index.ts +0 -3
  33. package/lib/validations/validations.js +12 -4
  34. package/package.json +2 -2
  35. package/.nyc_output/bc8b1674-6bc0-41b1-9ecc-e743722f5e07.json +0 -1
  36. package/.nyc_output/processinfo/7af1fd1b-43f3-4332-8732-30c12d3dec44.json +0 -1
  37. package/.nyc_output/processinfo/d4cf5029-96ae-4c0c-aefb-ba8b1c412b93.json +0 -1
  38. /package/.nyc_output/{7af1fd1b-43f3-4332-8732-30c12d3dec44.json → 011c99ee-70e2-4785-ba07-3b5e1591b03b.json} +0 -0
  39. /package/.nyc_output/{d4cf5029-96ae-4c0c-aefb-ba8b1c412b93.json → 5c634f75-5165-4488-a978-0129fbe23567.json} +0 -0
@@ -20,24 +20,24 @@
20
20
  </h1>
21
21
  <div class='clearfix'>
22
22
  <div class='fl pad1y space-right2'>
23
- <span class="strong">81.94% </span>
23
+ <span class="strong">80.71% </span>
24
24
  <span class="quiet">Statements</span>
25
- <span class='fraction'>118/144</span>
25
+ <span class='fraction'>113/140</span>
26
26
  </div>
27
27
  <div class='fl pad1y space-right2'>
28
- <span class="strong">75% </span>
28
+ <span class="strong">76.83% </span>
29
29
  <span class="quiet">Branches</span>
30
- <span class='fraction'>63/84</span>
30
+ <span class='fraction'>63/82</span>
31
31
  </div>
32
32
  <div class='fl pad1y space-right2'>
33
- <span class="strong">79.69% </span>
33
+ <span class="strong">78.13% </span>
34
34
  <span class="quiet">Functions</span>
35
- <span class='fraction'>51/64</span>
35
+ <span class='fraction'>50/64</span>
36
36
  </div>
37
37
  <div class='fl pad1y space-right2'>
38
- <span class="strong">82.52% </span>
38
+ <span class="strong">80.43% </span>
39
39
  <span class="quiet">Lines</span>
40
- <span class='fraction'>118/143</span>
40
+ <span class='fraction'>111/138</span>
41
41
  </div>
42
42
  </div>
43
43
  <p class="quiet">
@@ -408,8 +408,23 @@
408
408
  <a name='L360'></a><a href='#L360'>360</a>
409
409
  <a name='L361'></a><a href='#L361'>361</a>
410
410
  <a name='L362'></a><a href='#L362'>362</a>
411
- <a name='L363'></a><a href='#L363'>363</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
412
- <span class="cline-any cline-yes">1x</span>
411
+ <a name='L363'></a><a href='#L363'>363</a>
412
+ <a name='L364'></a><a href='#L364'>364</a>
413
+ <a name='L365'></a><a href='#L365'>365</a>
414
+ <a name='L366'></a><a href='#L366'>366</a>
415
+ <a name='L367'></a><a href='#L367'>367</a>
416
+ <a name='L368'></a><a href='#L368'>368</a>
417
+ <a name='L369'></a><a href='#L369'>369</a>
418
+ <a name='L370'></a><a href='#L370'>370</a>
419
+ <a name='L371'></a><a href='#L371'>371</a></td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span>
420
+ <span class="cline-any cline-neutral">&nbsp;</span>
421
+ <span class="cline-any cline-neutral">&nbsp;</span>
422
+ <span class="cline-any cline-neutral">&nbsp;</span>
423
+ <span class="cline-any cline-neutral">&nbsp;</span>
424
+ <span class="cline-any cline-neutral">&nbsp;</span>
425
+ <span class="cline-any cline-neutral">&nbsp;</span>
426
+ <span class="cline-any cline-neutral">&nbsp;</span>
427
+ <span class="cline-any cline-neutral">&nbsp;</span>
413
428
  <span class="cline-any cline-neutral">&nbsp;</span>
414
429
  <span class="cline-any cline-neutral">&nbsp;</span>
415
430
  <span class="cline-any cline-neutral">&nbsp;</span>
@@ -431,11 +446,11 @@
431
446
  <span class="cline-any cline-neutral">&nbsp;</span>
432
447
  <span class="cline-any cline-no">&nbsp;</span>
433
448
  <span class="cline-any cline-neutral">&nbsp;</span>
434
- <span class="cline-any cline-neutral">&nbsp;</span>
435
449
  <span class="cline-any cline-no">&nbsp;</span>
436
450
  <span class="cline-any cline-neutral">&nbsp;</span>
437
451
  <span class="cline-any cline-neutral">&nbsp;</span>
438
452
  <span class="cline-any cline-no">&nbsp;</span>
453
+ <span class="cline-any cline-neutral">&nbsp;</span>
439
454
  <span class="cline-any cline-no">&nbsp;</span>
440
455
  <span class="cline-any cline-no">&nbsp;</span>
441
456
  <span class="cline-any cline-neutral">&nbsp;</span>
@@ -465,6 +480,7 @@
465
480
  <span class="cline-any cline-neutral">&nbsp;</span>
466
481
  <span class="cline-any cline-neutral">&nbsp;</span>
467
482
  <span class="cline-any cline-yes">3x</span>
483
+ <span class="cline-any cline-neutral">&nbsp;</span>
468
484
  <span class="cline-any cline-yes">3x</span>
469
485
  <span class="cline-any cline-neutral">&nbsp;</span>
470
486
  <span class="cline-any cline-no">&nbsp;</span>
@@ -479,7 +495,6 @@
479
495
  <span class="cline-any cline-yes">1x</span>
480
496
  <span class="cline-any cline-yes">1x</span>
481
497
  <span class="cline-any cline-yes">1x</span>
482
- <span class="cline-any cline-neutral">&nbsp;</span>
483
498
  <span class="cline-any cline-no">&nbsp;</span>
484
499
  <span class="cline-any cline-neutral">&nbsp;</span>
485
500
  <span class="cline-any cline-neutral">&nbsp;</span>
@@ -491,7 +506,6 @@
491
506
  <span class="cline-any cline-neutral">&nbsp;</span>
492
507
  <span class="cline-any cline-neutral">&nbsp;</span>
493
508
  <span class="cline-any cline-neutral">&nbsp;</span>
494
- <span class="cline-any cline-neutral">&nbsp;</span>
495
509
  <span class="cline-any cline-yes">2x</span>
496
510
  <span class="cline-any cline-yes">2x</span>
497
511
  <span class="cline-any cline-yes">1x</span>
@@ -507,14 +521,18 @@
507
521
  <span class="cline-any cline-yes">1x</span>
508
522
  <span class="cline-any cline-neutral">&nbsp;</span>
509
523
  <span class="cline-any cline-neutral">&nbsp;</span>
524
+ <span class="cline-any cline-neutral">&nbsp;</span>
510
525
  <span class="cline-any cline-yes">2x</span>
511
526
  <span class="cline-any cline-yes">1x</span>
512
527
  <span class="cline-any cline-neutral">&nbsp;</span>
528
+ <span class="cline-any cline-neutral">&nbsp;</span>
513
529
  <span class="cline-any cline-yes">1x</span>
514
530
  <span class="cline-any cline-neutral">&nbsp;</span>
515
531
  <span class="cline-any cline-neutral">&nbsp;</span>
516
532
  <span class="cline-any cline-neutral">&nbsp;</span>
517
533
  <span class="cline-any cline-neutral">&nbsp;</span>
534
+ <span class="cline-any cline-neutral">&nbsp;</span>
535
+ <span class="cline-any cline-neutral">&nbsp;</span>
518
536
  <span class="cline-any cline-yes">5x</span>
519
537
  <span class="cline-any cline-neutral">&nbsp;</span>
520
538
  <span class="cline-any cline-neutral">&nbsp;</span>
@@ -522,6 +540,7 @@
522
540
  <span class="cline-any cline-neutral">&nbsp;</span>
523
541
  <span class="cline-any cline-neutral">&nbsp;</span>
524
542
  <span class="cline-any cline-neutral">&nbsp;</span>
543
+ <span class="cline-any cline-neutral">&nbsp;</span>
525
544
  <span class="cline-any cline-yes">5x</span>
526
545
  <span class="cline-any cline-neutral">&nbsp;</span>
527
546
  <span class="cline-any cline-neutral">&nbsp;</span>
@@ -540,7 +559,6 @@
540
559
  <span class="cline-any cline-neutral">&nbsp;</span>
541
560
  <span class="cline-any cline-neutral">&nbsp;</span>
542
561
  <span class="cline-any cline-neutral">&nbsp;</span>
543
- <span class="cline-any cline-neutral">&nbsp;</span>
544
562
  <span class="cline-any cline-yes">2x</span>
545
563
  <span class="cline-any cline-yes">2x</span>
546
564
  <span class="cline-any cline-neutral">&nbsp;</span>
@@ -550,7 +568,6 @@
550
568
  <span class="cline-any cline-neutral">&nbsp;</span>
551
569
  <span class="cline-any cline-yes">2x</span>
552
570
  <span class="cline-any cline-yes">2x</span>
553
- <span class="cline-any cline-yes">1x</span>
554
571
  <span class="cline-any cline-neutral">&nbsp;</span>
555
572
  <span class="cline-any cline-yes">1x</span>
556
573
  <span class="cline-any cline-neutral">&nbsp;</span>
@@ -569,7 +586,6 @@
569
586
  <span class="cline-any cline-neutral">&nbsp;</span>
570
587
  <span class="cline-any cline-yes">2x</span>
571
588
  <span class="cline-any cline-neutral">&nbsp;</span>
572
- <span class="cline-any cline-neutral">&nbsp;</span>
573
589
  <span class="cline-any cline-yes">4x</span>
574
590
  <span class="cline-any cline-yes">2x</span>
575
591
  <span class="cline-any cline-neutral">&nbsp;</span>
@@ -583,7 +599,6 @@
583
599
  <span class="cline-any cline-neutral">&nbsp;</span>
584
600
  <span class="cline-any cline-yes">2x</span>
585
601
  <span class="cline-any cline-neutral">&nbsp;</span>
586
- <span class="cline-any cline-neutral">&nbsp;</span>
587
602
  <span class="cline-any cline-yes">3x</span>
588
603
  <span class="cline-any cline-yes">2x</span>
589
604
  <span class="cline-any cline-neutral">&nbsp;</span>
@@ -596,7 +611,6 @@
596
611
  <span class="cline-any cline-neutral">&nbsp;</span>
597
612
  <span class="cline-any cline-neutral">&nbsp;</span>
598
613
  <span class="cline-any cline-yes">3x</span>
599
- <span class="cline-any cline-yes">1x</span>
600
614
  <span class="cline-any cline-neutral">&nbsp;</span>
601
615
  <span class="cline-any cline-yes">2x</span>
602
616
  <span class="cline-any cline-yes">2x</span>
@@ -634,7 +648,6 @@
634
648
  <span class="cline-any cline-neutral">&nbsp;</span>
635
649
  <span class="cline-any cline-yes">2x</span>
636
650
  <span class="cline-any cline-neutral">&nbsp;</span>
637
- <span class="cline-any cline-neutral">&nbsp;</span>
638
651
  <span class="cline-any cline-yes">3x</span>
639
652
  <span class="cline-any cline-yes">3x</span>
640
653
  <span class="cline-any cline-yes">1x</span>
@@ -763,13 +776,16 @@
763
776
  <span class="cline-any cline-neutral">&nbsp;</span>
764
777
  <span class="cline-any cline-neutral">&nbsp;</span>
765
778
  <span class="cline-any cline-neutral">&nbsp;</span>
766
- <span class="cline-any cline-yes">1x</span>
767
- <span class="cline-any cline-yes">79x</span>
779
+ <span class="cline-any cline-no">&nbsp;</span>
780
+ <span class="cline-any cline-neutral">&nbsp;</span>
781
+ <span class="cline-any cline-neutral">&nbsp;</span>
782
+ <span class="cline-any cline-neutral">&nbsp;</span>
783
+ <span class="cline-any cline-no">&nbsp;</span>
784
+ <span class="cline-any cline-neutral">&nbsp;</span>
785
+ <span class="cline-any cline-neutral">&nbsp;</span>
768
786
  <span class="cline-any cline-neutral">&nbsp;</span>
769
- <span class="cline-any cline-yes">79x</span>
770
787
  <span class="cline-any cline-neutral">&nbsp;</span>
771
788
  <span class="cline-any cline-neutral">&nbsp;</span>
772
- <span class="cline-any cline-yes">1x</span>
773
789
  <span class="cline-any cline-neutral">&nbsp;</span></td><td class="text"><pre class="prettyprint lang-js">const V = require('validator');
774
790
  const _ = require('lodash');
775
791
  const {
@@ -787,69 +803,69 @@ const stellarSDK = require('stellar-sdk');
787
803
  const E = require('../errors/errors');
788
804
  &nbsp;
789
805
  const validations = {
790
- <span class="fstat-no" title="function not covered" > _validate(</span>Err, pred, x, msg) {
791
- <span class="cstat-no" title="statement not covered" > if (pred(x)) {</span>
792
- <span class="cstat-no" title="statement not covered" > return x;</span>
806
+ _validate(Err, pred, x, msg) {
807
+ if (pred(x)) {
808
+ return x;
793
809
  }
794
- <span class="cstat-no" title="statement not covered" > throw new Err(msg);</span>
795
- },
796
- <span class="fstat-no" title="function not covered" > _validateArg(</span>pred, x, msg) {
797
- <span class="cstat-no" title="statement not covered" > return this._validate(E.InvalidArguments, pred, x, msg);</span>
810
+ throw new Err(msg);
798
811
  },
799
- <span class="fstat-no" title="function not covered" > _tryCheck(</span>fn, arg) {
800
- <span class="cstat-no" title="statement not covered" > try {</span>
812
+ _validateArg(pred, x, msg) {
813
+ <span class="fstat-no" title="function not covered" > return t</span>his._validate(E.InvalidArguments, pred, x, msg);
814
+ <span class="cstat-no" title="statement not covered" > },</span>
815
+ <span class="cstat-no" title="statement not covered" > _tryCheck(fn,</span> arg) {
816
+ try {
801
817
  <span class="cstat-no" title="statement not covered" > fn(arg);</span>
802
- <span class="cstat-no" title="statement not covered" > return true;</span>
803
- } catch (error) {
804
- <span class="cstat-no" title="statement not covered" > return false;</span>
805
- }
806
- },
818
+ return true;
819
+ }<span class="fstat-no" title="function not covered" > <span class="cstat-no" title="statement not covered" >c</span>atch (error) {</span>
820
+ return false;
821
+ }<span class="fstat-no" title="function not covered" ></span>
822
+ <span class="cstat-no" title="statement not covered" > },</span>
807
823
  &nbsp;
808
- exists(x) {
809
- return x != null;
824
+ <span class="cstat-no" title="statement not covered" > exists(x) {</span>
825
+ <span class="cstat-no" title="statement not covered" > return x != n</span>ull;
810
826
  },
811
- nonEmpty(x) {
827
+ <span class="cstat-no" title="statement not covered" > nonEmpty(x) {</span>
812
828
  return (x != null ? x.length : undefined) &gt; 0;
813
829
  },
814
830
  isNonEmptyString(x) {
815
- return _.isString(x) &amp;&amp; (x != null ? x.length : <span class="branch-1 cbranch-no" title="branch not covered" >undefined)</span> &gt; 0;
831
+ return _.isString(x) &amp;&amp; (x != null ? x.length : undefined) &gt; 0;
816
832
  },
817
833
  isSafeString(str) {
818
834
  // eslint-disable-next-line no-useless-escape
819
835
  return RegExp(/^(\p{L}|[0-9]|-|=|!|\.|:|\s|@|\+|_|,|\$|£|&amp;)+$/, 'u').test(str);
820
836
  },
821
837
  ensureShortEnough(limit, x) {
822
- const l = x != null ? x.length : undefined;
838
+ const l = x != null ? x.length : undefined;<span class="branch-1 cbranch-no" title="branch not covered" ></span>
823
839
  if (l &lt;= limit) {
824
840
  return true;
825
841
  }
826
842
  throw new E.BadRequest(`Max query size exceeded: ${l} / ${limit}`);
827
843
  },
828
844
  ensure(crit, msg) {
829
- <span class="missing-if-branch" title="else path not taken" >E</span>if (crit) {
845
+ if (crit) {
830
846
  return true;
831
847
  }
832
- <span class="cstat-no" title="statement not covered" > throw new E.BadRequest(msg);</span>
833
- },
834
- <span class="fstat-no" title="function not covered" > argExists(</span>x, msg) {
835
- <span class="cstat-no" title="statement not covered" > return this._validateArg(this.exists, x, msg);</span>
848
+ throw new E.BadRequest(msg);
836
849
  },
850
+ argExists(x, msg) {
851
+ return this._validateArg(this.exists, x, msg);
852
+ <span class="missing-if-branch" title="else path not taken" >E</span>},
837
853
  &nbsp;
838
854
  check: {
839
855
  matches(required, given, msg) {
840
- const newGiven = _.uniq(given);
856
+ <span class="cstat-no" title="statement not covered" > const newGiven = _.uniq(</span>given);
841
857
  const crit = _.intersection(newGiven, required).length === given.length;
842
- <span class="missing-if-branch" title="else path not taken" >E</span>if (crit) {
843
- return true;
858
+ <span class="fstat-no" title="function not covered" > if (c</span>rit) {
859
+ <span class="cstat-no" title="statement not covered" > return true;</span>
844
860
  }
845
- <span class="cstat-no" title="statement not covered" > throw new E.BadRequest(msg);</span>
861
+ throw new E.BadRequest(msg);
846
862
  },
847
863
  wasFound(type) {
848
864
  return (item) =&gt; {
849
865
  if (item == null) {
850
- throw new E.NotFound(`Unknown ${type}`);
866
+ <span class="missing-if-branch" title="else path not taken" >E</span>throw new E.NotFound(`Unknown ${type}`);
851
867
  } else {
852
- return item;
868
+ <span class="cstat-no" title="statement not covered" > return item;</span>
853
869
  }
854
870
  };
855
871
  },
@@ -879,31 +895,31 @@ const validations = {
879
895
  isCustomerReference(x) {
880
896
  return (
881
897
  _.isString(x)
882
- &amp;&amp; (x != null ? x.length : <span class="branch-1 cbranch-no" title="branch not covered" >undefined)</span> &gt; 0
883
- &amp;&amp; (x != null ? x.length : <span class="branch-1 cbranch-no" title="branch not covered" >undefined)</span> &lt;= 100
898
+ &amp;&amp; (x != null ? x.length : undefined) &gt; 0
899
+ &amp;&amp; (x != null ? x.length : undefined) &lt;= 100
884
900
  );
885
901
  },
886
902
  isCustomerLabelName(x) {
887
903
  return (
888
904
  _.isString(x)
889
- &amp;&amp; (x != null ? x.length : <span class="branch-1 cbranch-no" title="branch not covered" >undefined)</span> &gt; 0
890
- &amp;&amp; (x != null ? x.length : <span class="branch-1 cbranch-no" title="branch not covered" >undefined)</span> &lt;= 50
905
+ &amp;&amp; (x != null ? x.length : undefined) &gt; 0
906
+ &amp;&amp; (x != null ? x.length : undefined) &lt;= 50
891
907
  );
892
908
  },
893
- binanceChain: {
894
- isAddress(str) {
909
+ binanceChain: <span class="branch-1 cbranch-no" title="branch not covered" >{</span>
910
+ isAddress(str<span class="branch-1 cbranch-no" title="branch not covered" >) {</span>
895
911
  return /^(bnb)([a-z0-9]{39})$/.test(str);
896
912
  },
897
913
  isTxHash(str) {
898
914
  if (!V.isHexadecimal(str)) {
899
915
  return false;
900
- }
901
- return str.length === 64;
916
+ }<span class="branch-1 cbranch-no" title="branch not covered" ></span>
917
+ return str.length<span class="branch-1 cbranch-no" title="branch not covered" > === 64;</span>
902
918
  },
903
919
  },
904
920
  bitcoin: {
905
921
  isAddress(str) {
906
- const network = process.env.BITCOIN_NETWORK === 'testnet' ? <span class="branch-0 cbranch-no" title="branch not covered" >'testnet' </span>: 'prod';
922
+ const network = process.env.BITCOIN_NETWORK === 'testnet' ? 'testnet' : 'prod';
907
923
  return typeof str === 'string' &amp;&amp; addressValidator.validate(str.trim(), 'btc', network);
908
924
  },
909
925
  isBech32Address(str) {
@@ -913,7 +929,7 @@ const validations = {
913
929
  try {
914
930
  HDPublicKey(str);
915
931
  return true;
916
- } catch (error) {
932
+ } catch (error) <span class="branch-0 cbranch-no" title="branch not covered" >{</span>
917
933
  return false;
918
934
  }
919
935
  },
@@ -926,8 +942,8 @@ const validations = {
926
942
  }
927
943
  },
928
944
  isTxHash(str) {
929
- <span class="missing-if-branch" title="if path not taken" >I</span>if (!V.isHexadecimal(str)) {
930
- <span class="cstat-no" title="statement not covered" > return false;</span>
945
+ if (!V.isHexadecimal(str)) {
946
+ return false;
931
947
  }
932
948
  return str.length === 64;
933
949
  },
@@ -935,8 +951,8 @@ const validations = {
935
951
  if (!V.isHexadecimal(str)) {
936
952
  return false;
937
953
  }
938
- try {
939
- Transaction(str);
954
+ <span class="missing-if-branch" title="if path not taken" >I</span>try {
955
+ <span class="cstat-no" title="statement not covered" > Transaction(</span>str);
940
956
  return true;
941
957
  } catch (error) {
942
958
  return false;
@@ -953,14 +969,14 @@ const validations = {
953
969
  Script(str);
954
970
  return true;
955
971
  } catch (error) {
956
- <span class="cstat-no" title="statement not covered" > return false;</span>
972
+ return false;
957
973
  }
958
974
  },
959
975
  isTxSignature(str) {
960
976
  if (!V.isHexadecimal(str)) {
961
977
  return false;
962
978
  }
963
- try {
979
+ <span class="cstat-no" title="statement not covered" > try {</span>
964
980
  const b = Buffer.from(str, 'hex');
965
981
  Signature.fromTxFormat(b);
966
982
  return true;
@@ -1077,58 +1093,66 @@ const validations = {
1077
1093
  },
1078
1094
  },
1079
1095
  tezos: {
1080
- <span class="fstat-no" title="function not covered" > isAddress(</span>str) {
1081
- <span class="cstat-no" title="statement not covered" > return str[0] !== 'o' &amp;&amp; addressValidator.validate(str, 'xtz');</span>
1082
- },
1083
- <span class="fstat-no" title="function not covered" > isTxHash(</span>str) {
1084
- <span class="cstat-no" title="statement not covered" > return str.length === 51;</span>
1096
+ isAddress(str) {
1097
+ return str[0] !== 'o' &amp;&amp; addressValidator.validate(str, 'xtz');
1085
1098
  },
1086
- },
1099
+ isTxHash(str) {
1100
+ return str.length === 51;
1101
+ <span class="fstat-no" title="function not covered" > },</span>
1102
+ }<span class="cstat-no" title="statement not covered" >,</span>
1087
1103
  polkadot: {
1088
- isAddress(str) {
1089
- return addressValidator.validate(str, 'dot');
1104
+ <span class="fstat-no" title="function not covered" > isAddress(</span>str) {
1105
+ <span class="cstat-no" title="statement not covered" > return addressValidator.</span>validate(str, 'dot');
1090
1106
  },
1091
1107
  isTxHash(str) {
1092
1108
  return str.length === 66 &amp;&amp; web3.isHexStrict(str);
1093
1109
  },
1094
1110
  },
1095
1111
  cardano: {
1096
- <span class="fstat-no" title="function not covered" > isAddress(</span>str) {
1097
- <span class="cstat-no" title="statement not covered" > return addressValidator.validate(str, 'ada');</span>
1112
+ isAddress(str) {
1113
+ return addressValidator.validate(str, 'ada');
1098
1114
  },
1099
- <span class="fstat-no" title="function not covered" > isTxHash(</span>str) {
1100
- <span class="cstat-no" title="statement not covered" > if (!V.isHexadecimal(str)) {</span>
1101
- <span class="cstat-no" title="statement not covered" > return false;</span>
1102
- }
1103
- <span class="cstat-no" title="statement not covered" > return str.length === 64;</span>
1115
+ isTxHash(str) {
1116
+ if (!V.isHexadecimal(str)) {
1117
+ <span class="fstat-no" title="function not covered" > return f</span>alse;
1118
+ }<span class="cstat-no" title="statement not covered" ></span>
1119
+ return str.length === 64;
1120
+ <span class="fstat-no" title="function not covered" > },</span>
1121
+ }<span class="cstat-no" title="statement not covered" >,</span>
1122
+ <span class="cstat-no" title="statement not covered" > cryptocom: {</span>
1123
+ isAddress(str) {
1124
+ <span class="cstat-no" title="statement not covered" > return addressValidator.</span>validate(str, 'cro');
1104
1125
  },
1105
- },
1106
- cryptocom: {
1107
- <span class="fstat-no" title="function not covered" > isAddress(</span>str) {
1108
- <span class="cstat-no" title="statement not covered" > return addressValidator.validate(str, 'cro');</span>
1126
+ isTxHash(str) {
1127
+ if (!V.isHexadecimal(str)) {
1128
+ <span class="fstat-no" title="function not covered" > return f</span>alse;
1129
+ }<span class="cstat-no" title="statement not covered" ></span>
1130
+ return str.length === 64;
1131
+ <span class="fstat-no" title="function not covered" > },</span>
1132
+ }<span class="cstat-no" title="statement not covered" >,</span>
1133
+ near<span class="cstat-no" title="statement not covered" >: {</span>
1134
+ isAddress(str) {
1135
+ <span class="cstat-no" title="statement not covered" > // https://nomicon.io/DataStructures/Account</span>
1136
+ return /^(([a-z\d]+[-_])*[a-z\d]+\.)*([a-z\d]+[-_])*[a-z\d]+$/.test(str);
1109
1137
  },
1110
- <span class="fstat-no" title="function not covered" > isTxHash(</span>str) {
1111
- <span class="cstat-no" title="statement not covered" > if (!V.isHexadecimal(str)) {</span>
1112
- <span class="cstat-no" title="statement not covered" > return false;</span>
1113
- }
1114
- <span class="cstat-no" title="statement not covered" > return str.length === 64;</span>
1138
+ isTxHash(str) {
1139
+ <span class="fstat-no" title="function not covered" > return s</span>tr.length === 44 || str.length === 43;
1115
1140
  },
1116
- },
1117
- near: {
1141
+ }<span class="cstat-no" title="statement not covered" >,</span>
1142
+ doge: {
1118
1143
  <span class="fstat-no" title="function not covered" > isAddress(</span>str) {
1119
- // https://nomicon.io/DataStructures/Account
1120
- <span class="cstat-no" title="statement not covered" > return /^(([a-z\d]+[-_])*[a-z\d]+\.)*([a-z\d]+[-_])*[a-z\d]+$/.test(str);</span>
1144
+ <span class="cstat-no" title="statement not covered" > return /^D{1}[a-zA-Z\d]{33}$/.test(str);</span>
1121
1145
  },
1122
- <span class="fstat-no" title="function not covered" > isTxHash(</span>str) {
1123
- <span class="cstat-no" title="statement not covered" > return str.length === 44 || str.length === 43;</span>
1124
- },
1125
- },
1146
+ isTxHash(str) {
1147
+ return str.length === 64;
1148
+ <span class="fstat-no" title="function not covered" > },</span>
1149
+ }<span class="cstat-no" title="statement not covered" >,</span>
1126
1150
  };
1127
1151
  &nbsp;
1128
- Object.keys(V).forEach((k) =&gt; {
1129
- const v = V[k];
1152
+ <span class="fstat-no" title="function not covered" >Object.</span>keys(V).forEach((k) =&gt; {
1153
+ <span class="cstat-no" title="statement not covered" > const v = V[k];</span>
1130
1154
  // don't trigger validation with null values (prevents swagger 500 error)
1131
- validations[k] = <span class="fstat-no" title="function not covered" >(x</span>) =&gt; (<span class="cstat-no" title="statement not covered" >x === null ? false : v(x))</span>;
1155
+ validations[k] = (x) =&gt; (x === null ? false : v(x));
1132
1156
  });
1133
1157
  &nbsp;
1134
1158
  module.exports = validations;
@@ -1138,7 +1162,7 @@ module.exports = validations;
1138
1162
  </div><!-- /wrapper -->
1139
1163
  <div class='footer quiet pad2 space-top1 center small'>
1140
1164
  Code coverage
1141
- generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Feb 21 2022 17:07:29 GMT+0100 (CET)
1165
+ generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Mon Mar 28 2022 22:11:06 GMT+0200 (CEST)
1142
1166
  </div>
1143
1167
  </div>
1144
1168
  <script src="../prettify.js"></script>