@thirstie/thirstievalidators 0.0.6 → 0.1.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.
- package/CHANGELOG.md +13 -10
- package/LICENSE +21 -0
- package/README.md +9 -10
- package/coverage/clover.xml +114 -0
- package/coverage/coverage-final.json +6 -0
- package/coverage/lcov-report/agegate.js.html +178 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/emailLists.js.html +259 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +176 -0
- package/coverage/lcov-report/index.js.html +343 -0
- package/coverage/lcov-report/iso3166codes.js.html +331 -0
- package/coverage/lcov-report/passwordcheck.js.html +178 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov.info +239 -0
- package/dist/bundle.cjs +4462 -10
- package/dist/bundle.iife.js +1 -1
- package/dist/bundle.mjs +4461 -10
- package/package.json +5 -2
- package/src/agegate.js +31 -0
- package/src/emailLists.js +58 -0
- package/src/index.js +60 -9
- package/src/iso3166codes.js +82 -0
- package/src/passwordcheck.js +0 -1
- package/tests/unit/checkers.agegate.unit.test.js +40 -0
- package/tests/unit/{passwordcheck.unit.test.js → checkers.password.unit.test.js} +2 -2
- package/tests/unit/validators.agegate.unit.test.js +31 -0
- package/tests/unit/validators.email.unit.test.js +29 -3
- package/tests/unit/validators.other.unit.test.js +40 -0
package/CHANGELOG.md
CHANGED
|
@@ -3,29 +3,32 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
# [0.1.0](https://github.com/ThirstieAdmin/thirstiejs-monorepo/compare/@thirstie/thirstievalidators@0.0.3...@thirstie/thirstievalidators@0.1.0) (2024-10-07)
|
|
7
7
|
|
|
8
|
-
**Note:** Version bump only for package @thirstie/thirstievalidators
|
|
9
8
|
|
|
9
|
+
### Bug Fixes
|
|
10
10
|
|
|
11
|
+
* age gate validation ([6f88a6f](https://github.com/ThirstieAdmin/thirstiejs-monorepo/commit/6f88a6fb88d4a2b02807eb457efbf28e95d2b232))
|
|
11
12
|
|
|
12
13
|
|
|
14
|
+
### Features
|
|
13
15
|
|
|
14
|
-
|
|
16
|
+
* add state code, email domain checkers ([e5590ba](https://github.com/ThirstieAdmin/thirstiejs-monorepo/commit/e5590ba6f3e2dd5b6f0952a39ca0b595aa08ed21))
|
|
17
|
+
* trusted email domain ([bd36a3c](https://github.com/ThirstieAdmin/thirstiejs-monorepo/commit/bd36a3c6b2044d0acfa1d3c0250c68d3b46975fa))
|
|
18
|
+
* validator package ([7cc609a](https://github.com/ThirstieAdmin/thirstiejs-monorepo/commit/7cc609a78cd030c866542a629d6bf307ad9b08c8))
|
|
15
19
|
|
|
16
|
-
**Note:** Version bump only for package @thirstie/thirstievalidators
|
|
17
20
|
|
|
18
21
|
|
|
19
22
|
|
|
20
23
|
|
|
24
|
+
## [0.0.6](https://github.com/ThirstieAdmin/thirstiejs-monorepo/compare/@thirstie/thirstievalidators@0.0.4...@thirstie/thirstievalidators@0.0.6) (2024-06-24)
|
|
25
|
+
|
|
26
|
+
**Note:** Version bump only for package @thirstie/thirstievalidators
|
|
21
27
|
|
|
22
|
-
# Changelog
|
|
23
28
|
|
|
24
|
-
All notable changes to this project will be documented in this file.
|
|
25
29
|
|
|
26
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
27
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
28
30
|
|
|
29
|
-
## Unreleased
|
|
30
31
|
|
|
31
|
-
-
|
|
32
|
+
## [0.0.5](https://github.com/ThirstieAdmin/thirstiejs-monorepo/compare/@thirstie/thirstievalidators@0.0.4...@thirstie/thirstievalidators@0.0.5) (2024-06-24)
|
|
33
|
+
|
|
34
|
+
**Note:** Version bump only for package @thirstie/thirstievalidators
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Thirstie
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Thirstie Validators
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
- review https://github.com/validatorjs/validator.js
|
|
5
|
-
- see https://github.com/jameslk/awesome-falsehoods on why it's better to use a standard library
|
|
6
|
-
- probably will use our own email validator
|
|
7
|
-
- others are probably okay?
|
|
3
|
+
This library exposes two groups of data validation functions:
|
|
8
4
|
|
|
5
|
+
1. `Validators`: return a boolean `true/false` if value passes validation
|
|
6
|
+
2. `Checkers`: more generic checks, such as password strength or email reliability
|
|
9
7
|
|
|
10
|
-
# `passwordcheck`
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
# `Checkers.passwordcheck`
|
|
10
|
+
|
|
11
|
+
> Classifies a password as 'weak', 'acceptable', or 'strong'.
|
|
13
12
|
|
|
14
13
|
## Usage
|
|
15
14
|
|
|
16
|
-
```
|
|
15
|
+
```javascript
|
|
17
16
|
const passwordcheck = require('passwordcheck');
|
|
18
17
|
|
|
19
18
|
const pwStrength = passwordcheck('password');
|
|
20
19
|
console.log(pwStrength);
|
|
21
|
-
> 0 # Too Weak
|
|
22
20
|
|
|
21
|
+
> {strength: 0, label: 'weak'}
|
|
23
22
|
```
|
|
24
23
|
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<coverage generated="1728330746191" clover="3.2.0">
|
|
3
|
+
<project timestamp="1728330746191" name="All files">
|
|
4
|
+
<metrics statements="93" coveredstatements="77" conditionals="69" coveredconditionals="46" methods="16" coveredmethods="13" elements="178" coveredelements="136" complexity="0" loc="93" ncloc="93" packages="1" files="5" classes="5"/>
|
|
5
|
+
<file name="agegate.js" path="/Users/bartmosley/Developer/thirstiedev/thirstiejs-monorepo/packages/thirstievalidators/src/agegate.js">
|
|
6
|
+
<metrics statements="20" coveredstatements="19" conditionals="11" coveredconditionals="9" methods="1" coveredmethods="1"/>
|
|
7
|
+
<line num="3" count="5" type="cond" truecount="1" falsecount="0"/>
|
|
8
|
+
<line num="4" count="8" type="stmt"/>
|
|
9
|
+
<line num="5" count="8" type="stmt"/>
|
|
10
|
+
<line num="6" count="8" type="cond" truecount="2" falsecount="0"/>
|
|
11
|
+
<line num="8" count="8" type="stmt"/>
|
|
12
|
+
<line num="9" count="8" type="stmt"/>
|
|
13
|
+
<line num="10" count="8" type="stmt"/>
|
|
14
|
+
<line num="12" count="0" type="stmt"/>
|
|
15
|
+
<line num="15" count="8" type="stmt"/>
|
|
16
|
+
<line num="16" count="8" type="stmt"/>
|
|
17
|
+
<line num="17" count="8" type="cond" truecount="2" falsecount="0"/>
|
|
18
|
+
<line num="19" count="5" type="stmt"/>
|
|
19
|
+
<line num="20" count="5" type="stmt"/>
|
|
20
|
+
<line num="21" count="5" type="stmt"/>
|
|
21
|
+
<line num="23" count="3" type="cond" truecount="1" falsecount="1"/>
|
|
22
|
+
<line num="24" count="3" type="stmt"/>
|
|
23
|
+
<line num="25" count="3" type="stmt"/>
|
|
24
|
+
<line num="26" count="3" type="cond" truecount="1" falsecount="1"/>
|
|
25
|
+
<line num="28" count="3" type="stmt"/>
|
|
26
|
+
<line num="30" count="8" type="cond" truecount="2" falsecount="0"/>
|
|
27
|
+
</file>
|
|
28
|
+
<file name="emailLists.js" path="/Users/bartmosley/Developer/thirstiedev/thirstiejs-monorepo/packages/thirstievalidators/src/emailLists.js">
|
|
29
|
+
<metrics statements="2" coveredstatements="2" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0"/>
|
|
30
|
+
<line num="1" count="4" type="stmt"/>
|
|
31
|
+
<line num="27" count="4" type="stmt"/>
|
|
32
|
+
</file>
|
|
33
|
+
<file name="index.js" path="/Users/bartmosley/Developer/thirstiedev/thirstiejs-monorepo/packages/thirstievalidators/src/index.js">
|
|
34
|
+
<metrics statements="45" coveredstatements="31" conditionals="45" coveredconditionals="28" methods="10" coveredmethods="7"/>
|
|
35
|
+
<line num="8" count="4" type="stmt"/>
|
|
36
|
+
<line num="10" count="8" type="cond" truecount="4" falsecount="0"/>
|
|
37
|
+
<line num="11" count="8" type="stmt"/>
|
|
38
|
+
<line num="12" count="8" type="stmt"/>
|
|
39
|
+
<line num="13" count="8" type="cond" truecount="4" falsecount="0"/>
|
|
40
|
+
<line num="14" count="2" type="stmt"/>
|
|
41
|
+
<line num="15" count="2" type="stmt"/>
|
|
42
|
+
<line num="17" count="8" type="stmt"/>
|
|
43
|
+
<line num="20" count="3" type="cond" truecount="2" falsecount="0"/>
|
|
44
|
+
<line num="21" count="3" type="cond" truecount="3" falsecount="1"/>
|
|
45
|
+
<line num="22" count="3" type="stmt"/>
|
|
46
|
+
<line num="23" count="3" type="stmt"/>
|
|
47
|
+
<line num="25" count="0" type="stmt"/>
|
|
48
|
+
<line num="28" count="0" type="stmt"/>
|
|
49
|
+
<line num="29" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
50
|
+
<line num="30" count="0" type="stmt"/>
|
|
51
|
+
<line num="31" count="0" type="stmt"/>
|
|
52
|
+
<line num="33" count="0" type="stmt"/>
|
|
53
|
+
<line num="36" count="0" type="cond" truecount="0" falsecount="4"/>
|
|
54
|
+
<line num="37" count="0" type="stmt"/>
|
|
55
|
+
<line num="41" count="0" type="cond" truecount="0" falsecount="2"/>
|
|
56
|
+
<line num="42" count="0" type="stmt"/>
|
|
57
|
+
<line num="44" count="0" type="stmt"/>
|
|
58
|
+
<line num="47" count="6" type="cond" truecount="4" falsecount="0"/>
|
|
59
|
+
<line num="48" count="6" type="stmt"/>
|
|
60
|
+
<line num="49" count="6" type="cond" truecount="2" falsecount="0"/>
|
|
61
|
+
<line num="50" count="2" type="stmt"/>
|
|
62
|
+
<line num="52" count="4" type="stmt"/>
|
|
63
|
+
<line num="56" count="2" type="cond" truecount="2" falsecount="2"/>
|
|
64
|
+
<line num="57" count="2" type="stmt"/>
|
|
65
|
+
<line num="58" count="2" type="stmt"/>
|
|
66
|
+
<line num="60" count="4" type="stmt"/>
|
|
67
|
+
<line num="62" count="2" type="stmt"/>
|
|
68
|
+
<line num="63" count="2" type="stmt"/>
|
|
69
|
+
<line num="64" count="2" type="cond" truecount="2" falsecount="0"/>
|
|
70
|
+
<line num="65" count="1" type="stmt"/>
|
|
71
|
+
<line num="67" count="1" type="stmt"/>
|
|
72
|
+
<line num="72" count="4" type="stmt"/>
|
|
73
|
+
<line num="73" count="2" type="cond" truecount="1" falsecount="0"/>
|
|
74
|
+
<line num="75" count="0" type="stmt"/>
|
|
75
|
+
<line num="76" count="0" type="stmt"/>
|
|
76
|
+
<line num="77" count="0" type="stmt"/>
|
|
77
|
+
<line num="80" count="5" type="cond" truecount="1" falsecount="1"/>
|
|
78
|
+
<line num="81" count="5" type="stmt"/>
|
|
79
|
+
<line num="82" count="5" type="stmt"/>
|
|
80
|
+
</file>
|
|
81
|
+
<file name="iso3166codes.js" path="/Users/bartmosley/Developer/thirstiedev/thirstiejs-monorepo/packages/thirstievalidators/src/iso3166codes.js">
|
|
82
|
+
<metrics statements="9" coveredstatements="8" conditionals="5" coveredconditionals="2" methods="1" coveredmethods="1"/>
|
|
83
|
+
<line num="1" count="4" type="stmt"/>
|
|
84
|
+
<line num="55" count="4" type="stmt"/>
|
|
85
|
+
<line num="69" count="4" type="stmt"/>
|
|
86
|
+
<line num="74" count="4" type="cond" truecount="0" falsecount="1"/>
|
|
87
|
+
<line num="75" count="6" type="cond" truecount="1" falsecount="1"/>
|
|
88
|
+
<line num="76" count="6" type="stmt"/>
|
|
89
|
+
<line num="77" count="6" type="cond" truecount="1" falsecount="1"/>
|
|
90
|
+
<line num="78" count="6" type="stmt"/>
|
|
91
|
+
<line num="80" count="0" type="stmt"/>
|
|
92
|
+
</file>
|
|
93
|
+
<file name="passwordcheck.js" path="/Users/bartmosley/Developer/thirstiedev/thirstiejs-monorepo/packages/thirstievalidators/src/passwordcheck.js">
|
|
94
|
+
<metrics statements="17" coveredstatements="17" conditionals="8" coveredconditionals="7" methods="4" coveredmethods="4"/>
|
|
95
|
+
<line num="1" count="4" type="stmt"/>
|
|
96
|
+
<line num="2" count="4" type="stmt"/>
|
|
97
|
+
<line num="5" count="2" type="stmt"/>
|
|
98
|
+
<line num="6" count="2" type="stmt"/>
|
|
99
|
+
<line num="7" count="2" type="stmt"/>
|
|
100
|
+
<line num="13" count="4" type="stmt"/>
|
|
101
|
+
<line num="14" count="2" type="cond" truecount="1" falsecount="1"/>
|
|
102
|
+
<line num="15" count="2" type="cond" truecount="2" falsecount="0"/>
|
|
103
|
+
<line num="16" count="2" type="cond" truecount="2" falsecount="0"/>
|
|
104
|
+
<line num="17" count="2" type="cond" truecount="2" falsecount="0"/>
|
|
105
|
+
<line num="19" count="2" type="stmt"/>
|
|
106
|
+
<line num="20" count="2" type="stmt"/>
|
|
107
|
+
<line num="21" count="2" type="stmt"/>
|
|
108
|
+
<line num="24" count="4" type="stmt"/>
|
|
109
|
+
<line num="25" count="4" type="stmt"/>
|
|
110
|
+
<line num="27" count="2" type="stmt"/>
|
|
111
|
+
<line num="28" count="2" type="stmt"/>
|
|
112
|
+
</file>
|
|
113
|
+
</project>
|
|
114
|
+
</coverage>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{"/Users/bartmosley/Developer/thirstiedev/thirstiejs-monorepo/packages/thirstievalidators/src/agegate.js": {"path":"/Users/bartmosley/Developer/thirstiedev/thirstiejs-monorepo/packages/thirstievalidators/src/agegate.js","statementMap":{"0":{"start":{"line":3,"column":23},"end":{"line":31,"column":1}},"1":{"start":{"line":4,"column":32},"end":{"line":4,"column":58}},"2":{"start":{"line":5,"column":28},"end":{"line":5,"column":43}},"3":{"start":{"line":6,"column":2},"end":{"line":6,"column":28}},"4":{"start":{"line":8,"column":14},"end":{"line":8,"column":18}},"5":{"start":{"line":9,"column":2},"end":{"line":13,"column":3}},"6":{"start":{"line":10,"column":4},"end":{"line":10,"column":67}},"7":{"start":{"line":12,"column":4},"end":{"line":12,"column":14}},"8":{"start":{"line":15,"column":16},"end":{"line":15,"column":21}},"9":{"start":{"line":16,"column":35},"end":{"line":16,"column":76}},"10":{"start":{"line":17,"column":2},"end":{"line":29,"column":3}},"11":{"start":{"line":19,"column":6},"end":{"line":19,"column":31}},"12":{"start":{"line":20,"column":6},"end":{"line":20,"column":21}},"13":{"start":{"line":21,"column":6},"end":{"line":21,"column":12}},"14":{"start":{"line":23,"column":6},"end":{"line":27,"column":7}},"15":{"start":{"line":24,"column":22},"end":{"line":24,"column":32}},"16":{"start":{"line":25,"column":26},"end":{"line":25,"column":107}},"17":{"start":{"line":26,"column":8},"end":{"line":26,"column":58}},"18":{"start":{"line":28,"column":6},"end":{"line":28,"column":12}},"19":{"start":{"line":30,"column":2},"end":{"line":30,"column":85}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":3,"column":23},"end":{"line":3,"column":24}},"loc":{"start":{"line":3,"column":71},"end":{"line":31,"column":1}},"line":3}},"branchMap":{"0":{"loc":{"start":{"line":3,"column":51},"end":{"line":3,"column":66}},"type":"default-arg","locations":[{"start":{"line":3,"column":62},"end":{"line":3,"column":66}}],"line":3},"1":{"loc":{"start":{"line":6,"column":13},"end":{"line":6,"column":27}},"type":"binary-expr","locations":[{"start":{"line":6,"column":13},"end":{"line":6,"column":21}},{"start":{"line":6,"column":25},"end":{"line":6,"column":27}}],"line":6},"2":{"loc":{"start":{"line":17,"column":2},"end":{"line":29,"column":3}},"type":"switch","locations":[{"start":{"line":18,"column":4},"end":{"line":21,"column":12}},{"start":{"line":22,"column":4},"end":{"line":28,"column":12}}],"line":17},"3":{"loc":{"start":{"line":23,"column":6},"end":{"line":27,"column":7}},"type":"if","locations":[{"start":{"line":23,"column":6},"end":{"line":27,"column":7}},{"start":{},"end":{}}],"line":23},"4":{"loc":{"start":{"line":26,"column":18},"end":{"line":26,"column":57}},"type":"cond-expr","locations":[{"start":{"line":26,"column":31},"end":{"line":26,"column":36}},{"start":{"line":26,"column":39},"end":{"line":26,"column":57}}],"line":26},"5":{"loc":{"start":{"line":30,"column":67},"end":{"line":30,"column":82}},"type":"binary-expr","locations":[{"start":{"line":30,"column":67},"end":{"line":30,"column":74}},{"start":{"line":30,"column":78},"end":{"line":30,"column":82}}],"line":30}},"s":{"0":5,"1":8,"2":8,"3":8,"4":8,"5":8,"6":8,"7":0,"8":8,"9":8,"10":8,"11":5,"12":5,"13":5,"14":3,"15":3,"16":3,"17":3,"18":3,"19":8},"f":{"0":8},"b":{"0":[8],"1":[8,8],"2":[5,3],"3":[3,0],"4":[0,3],"5":[8,5]},"inputSourceMap":null,"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"576f38f3f80d67b5e7c71597639afdce6f2fdc95"}
|
|
2
|
+
,"/Users/bartmosley/Developer/thirstiedev/thirstiejs-monorepo/packages/thirstievalidators/src/emailLists.js": {"path":"/Users/bartmosley/Developer/thirstiedev/thirstiejs-monorepo/packages/thirstievalidators/src/emailLists.js","statementMap":{"0":{"start":{"line":1,"column":29},"end":{"line":25,"column":1}},"1":{"start":{"line":27,"column":35},"end":{"line":58,"column":1}}},"fnMap":{},"branchMap":{},"s":{"0":4,"1":4},"f":{},"b":{},"inputSourceMap":null,"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"dd8b849d5f74071cdee1392aa3386e5db35f8421"}
|
|
3
|
+
,"/Users/bartmosley/Developer/thirstiedev/thirstiejs-monorepo/packages/thirstievalidators/src/index.js": {"path":"/Users/bartmosley/Developer/thirstiedev/thirstiejs-monorepo/packages/thirstievalidators/src/index.js","statementMap":{"0":{"start":{"line":8,"column":19},"end":{"line":70,"column":1}},"1":{"start":{"line":10,"column":27},"end":{"line":10,"column":89}},"2":{"start":{"line":11,"column":23},"end":{"line":11,"column":134}},"3":{"start":{"line":12,"column":18},"end":{"line":12,"column":40}},"4":{"start":{"line":13,"column":4},"end":{"line":16,"column":5}},"5":{"start":{"line":14,"column":26},"end":{"line":14,"column":59}},"6":{"start":{"line":15,"column":6},"end":{"line":15,"column":53}},"7":{"start":{"line":17,"column":4},"end":{"line":17,"column":19}},"8":{"start":{"line":20,"column":23},"end":{"line":20,"column":62}},"9":{"start":{"line":21,"column":4},"end":{"line":24,"column":5}},"10":{"start":{"line":22,"column":26},"end":{"line":22,"column":39}},"11":{"start":{"line":23,"column":6},"end":{"line":23,"column":55}},"12":{"start":{"line":25,"column":4},"end":{"line":25,"column":17}},"13":{"start":{"line":28,"column":23},"end":{"line":28,"column":112}},"14":{"start":{"line":29,"column":4},"end":{"line":32,"column":5}},"15":{"start":{"line":30,"column":24},"end":{"line":30,"column":60}},"16":{"start":{"line":31,"column":6},"end":{"line":31,"column":40}},"17":{"start":{"line":33,"column":4},"end":{"line":33,"column":17}},"18":{"start":{"line":36,"column":20},"end":{"line":36,"column":98}},"19":{"start":{"line":37,"column":18},"end":{"line":40,"column":14}},"20":{"start":{"line":41,"column":4},"end":{"line":43,"column":5}},"21":{"start":{"line":42,"column":6},"end":{"line":42,"column":31}},"22":{"start":{"line":44,"column":4},"end":{"line":44,"column":17}},"23":{"start":{"line":47,"column":24},"end":{"line":47,"column":102}},"24":{"start":{"line":48,"column":18},"end":{"line":48,"column":73}},"25":{"start":{"line":49,"column":4},"end":{"line":53,"column":5}},"26":{"start":{"line":50,"column":6},"end":{"line":50,"column":19}},"27":{"start":{"line":52,"column":6},"end":{"line":52,"column":18}},"28":{"start":{"line":56,"column":24},"end":{"line":56,"column":102}},"29":{"start":{"line":57,"column":26},"end":{"line":57,"column":52}},"30":{"start":{"line":58,"column":28},"end":{"line":58,"column":50}},"31":{"start":{"line":60,"column":23},"end":{"line":60,"column":105}},"32":{"start":{"line":60,"column":60},"end":{"line":60,"column":80}},"33":{"start":{"line":62,"column":18},"end":{"line":62,"column":28}},"34":{"start":{"line":63,"column":17},"end":{"line":63,"column":28}},"35":{"start":{"line":64,"column":4},"end":{"line":68,"column":5}},"36":{"start":{"line":65,"column":6},"end":{"line":65,"column":35}},"37":{"start":{"line":67,"column":6},"end":{"line":67,"column":19}},"38":{"start":{"line":72,"column":17},"end":{"line":84,"column":1}},"39":{"start":{"line":73,"column":49},"end":{"line":73,"column":77}},"40":{"start":{"line":75,"column":20},"end":{"line":75,"column":66}},"41":{"start":{"line":76,"column":22},"end":{"line":76,"column":61}},"42":{"start":{"line":77,"column":4},"end":{"line":77,"column":34}},"43":{"start":{"line":80,"column":24},"end":{"line":80,"column":52}},"44":{"start":{"line":81,"column":21},"end":{"line":81,"column":37}},"45":{"start":{"line":82,"column":4},"end":{"line":82,"column":49}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":9,"column":9},"end":{"line":9,"column":10}},"loc":{"start":{"line":9,"column":36},"end":{"line":18,"column":3}},"line":9},"1":{"name":"(anonymous_1)","decl":{"start":{"line":19,"column":25},"end":{"line":19,"column":26}},"loc":{"start":{"line":19,"column":52},"end":{"line":26,"column":3}},"line":19},"2":{"name":"(anonymous_2)","decl":{"start":{"line":27,"column":15},"end":{"line":27,"column":16}},"loc":{"start":{"line":27,"column":42},"end":{"line":34,"column":3}},"line":27},"3":{"name":"(anonymous_3)","decl":{"start":{"line":35,"column":14},"end":{"line":35,"column":15}},"loc":{"start":{"line":35,"column":41},"end":{"line":45,"column":3}},"line":35},"4":{"name":"(anonymous_4)","decl":{"start":{"line":46,"column":21},"end":{"line":46,"column":22}},"loc":{"start":{"line":46,"column":48},"end":{"line":54,"column":3}},"line":46},"5":{"name":"(anonymous_5)","decl":{"start":{"line":55,"column":17},"end":{"line":55,"column":18}},"loc":{"start":{"line":55,"column":44},"end":{"line":69,"column":3}},"line":55},"6":{"name":"(anonymous_6)","decl":{"start":{"line":60,"column":46},"end":{"line":60,"column":47}},"loc":{"start":{"line":60,"column":60},"end":{"line":60,"column":80}},"line":60},"7":{"name":"(anonymous_7)","decl":{"start":{"line":73,"column":20},"end":{"line":73,"column":21}},"loc":{"start":{"line":73,"column":47},"end":{"line":73,"column":79}},"line":73},"8":{"name":"(anonymous_8)","decl":{"start":{"line":74,"column":14},"end":{"line":74,"column":15}},"loc":{"start":{"line":74,"column":41},"end":{"line":78,"column":3}},"line":74},"9":{"name":"(anonymous_9)","decl":{"start":{"line":79,"column":11},"end":{"line":79,"column":12}},"loc":{"start":{"line":79,"column":38},"end":{"line":83,"column":3}},"line":79}},"branchMap":{"0":{"loc":{"start":{"line":9,"column":17},"end":{"line":9,"column":31}},"type":"default-arg","locations":[{"start":{"line":9,"column":27},"end":{"line":9,"column":31}}],"line":9},"1":{"loc":{"start":{"line":10,"column":27},"end":{"line":10,"column":89}},"type":"cond-expr","locations":[{"start":{"line":10,"column":62},"end":{"line":10,"column":81}},{"start":{"line":10,"column":84},"end":{"line":10,"column":89}}],"line":10},"2":{"loc":{"start":{"line":10,"column":28},"end":{"line":10,"column":58}},"type":"binary-expr","locations":[{"start":{"line":10,"column":28},"end":{"line":10,"column":35}},{"start":{"line":10,"column":39},"end":{"line":10,"column":58}}],"line":10},"3":{"loc":{"start":{"line":13,"column":4},"end":{"line":16,"column":5}},"type":"if","locations":[{"start":{"line":13,"column":4},"end":{"line":16,"column":5}},{"start":{},"end":{}}],"line":13},"4":{"loc":{"start":{"line":13,"column":8},"end":{"line":13,"column":33}},"type":"binary-expr","locations":[{"start":{"line":13,"column":8},"end":{"line":13,"column":15}},{"start":{"line":13,"column":19},"end":{"line":13,"column":33}}],"line":13},"5":{"loc":{"start":{"line":19,"column":33},"end":{"line":19,"column":47}},"type":"default-arg","locations":[{"start":{"line":19,"column":43},"end":{"line":19,"column":47}}],"line":19},"6":{"loc":{"start":{"line":20,"column":23},"end":{"line":20,"column":62}},"type":"binary-expr","locations":[{"start":{"line":20,"column":23},"end":{"line":20,"column":28}},{"start":{"line":20,"column":32},"end":{"line":20,"column":62}}],"line":20},"7":{"loc":{"start":{"line":21,"column":4},"end":{"line":24,"column":5}},"type":"if","locations":[{"start":{"line":21,"column":4},"end":{"line":24,"column":5}},{"start":{},"end":{}}],"line":21},"8":{"loc":{"start":{"line":21,"column":8},"end":{"line":21,"column":45}},"type":"binary-expr","locations":[{"start":{"line":21,"column":8},"end":{"line":21,"column":18}},{"start":{"line":21,"column":22},"end":{"line":21,"column":45}}],"line":21},"9":{"loc":{"start":{"line":27,"column":23},"end":{"line":27,"column":37}},"type":"default-arg","locations":[{"start":{"line":27,"column":33},"end":{"line":27,"column":37}}],"line":27},"10":{"loc":{"start":{"line":29,"column":4},"end":{"line":32,"column":5}},"type":"if","locations":[{"start":{"line":29,"column":4},"end":{"line":32,"column":5}},{"start":{},"end":{}}],"line":29},"11":{"loc":{"start":{"line":35,"column":22},"end":{"line":35,"column":36}},"type":"default-arg","locations":[{"start":{"line":35,"column":32},"end":{"line":35,"column":36}}],"line":35},"12":{"loc":{"start":{"line":36,"column":20},"end":{"line":36,"column":98}},"type":"cond-expr","locations":[{"start":{"line":36,"column":55},"end":{"line":36,"column":88}},{"start":{"line":36,"column":91},"end":{"line":36,"column":98}}],"line":36},"13":{"loc":{"start":{"line":36,"column":21},"end":{"line":36,"column":51}},"type":"binary-expr","locations":[{"start":{"line":36,"column":21},"end":{"line":36,"column":28}},{"start":{"line":36,"column":32},"end":{"line":36,"column":51}}],"line":36},"14":{"loc":{"start":{"line":41,"column":4},"end":{"line":43,"column":5}},"type":"if","locations":[{"start":{"line":41,"column":4},"end":{"line":43,"column":5}},{"start":{},"end":{}}],"line":41},"15":{"loc":{"start":{"line":46,"column":29},"end":{"line":46,"column":43}},"type":"default-arg","locations":[{"start":{"line":46,"column":39},"end":{"line":46,"column":43}}],"line":46},"16":{"loc":{"start":{"line":47,"column":24},"end":{"line":47,"column":102}},"type":"cond-expr","locations":[{"start":{"line":47,"column":59},"end":{"line":47,"column":92}},{"start":{"line":47,"column":95},"end":{"line":47,"column":102}}],"line":47},"17":{"loc":{"start":{"line":47,"column":25},"end":{"line":47,"column":55}},"type":"binary-expr","locations":[{"start":{"line":47,"column":25},"end":{"line":47,"column":32}},{"start":{"line":47,"column":36},"end":{"line":47,"column":55}}],"line":47},"18":{"loc":{"start":{"line":49,"column":4},"end":{"line":53,"column":5}},"type":"if","locations":[{"start":{"line":49,"column":4},"end":{"line":53,"column":5}},{"start":{"line":51,"column":11},"end":{"line":53,"column":5}}],"line":49},"19":{"loc":{"start":{"line":55,"column":25},"end":{"line":55,"column":39}},"type":"default-arg","locations":[{"start":{"line":55,"column":35},"end":{"line":55,"column":39}}],"line":55},"20":{"loc":{"start":{"line":56,"column":24},"end":{"line":56,"column":102}},"type":"cond-expr","locations":[{"start":{"line":56,"column":59},"end":{"line":56,"column":92}},{"start":{"line":56,"column":95},"end":{"line":56,"column":102}}],"line":56},"21":{"loc":{"start":{"line":56,"column":25},"end":{"line":56,"column":55}},"type":"binary-expr","locations":[{"start":{"line":56,"column":25},"end":{"line":56,"column":32}},{"start":{"line":56,"column":36},"end":{"line":56,"column":55}}],"line":56},"22":{"loc":{"start":{"line":64,"column":4},"end":{"line":68,"column":5}},"type":"if","locations":[{"start":{"line":64,"column":4},"end":{"line":68,"column":5}},{"start":{"line":66,"column":11},"end":{"line":68,"column":5}}],"line":64},"23":{"loc":{"start":{"line":73,"column":28},"end":{"line":73,"column":42}},"type":"default-arg","locations":[{"start":{"line":73,"column":38},"end":{"line":73,"column":42}}],"line":73},"24":{"loc":{"start":{"line":74,"column":22},"end":{"line":74,"column":36}},"type":"default-arg","locations":[{"start":{"line":74,"column":32},"end":{"line":74,"column":36}}],"line":74},"25":{"loc":{"start":{"line":79,"column":19},"end":{"line":79,"column":33}},"type":"default-arg","locations":[{"start":{"line":79,"column":29},"end":{"line":79,"column":33}}],"line":79},"26":{"loc":{"start":{"line":80,"column":24},"end":{"line":80,"column":52}},"type":"binary-expr","locations":[{"start":{"line":80,"column":24},"end":{"line":80,"column":43}},{"start":{"line":80,"column":47},"end":{"line":80,"column":52}}],"line":80}},"s":{"0":4,"1":8,"2":8,"3":8,"4":8,"5":2,"6":2,"7":8,"8":3,"9":3,"10":3,"11":3,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":6,"24":6,"25":6,"26":2,"27":4,"28":2,"29":2,"30":2,"31":2,"32":4,"33":2,"34":2,"35":2,"36":1,"37":1,"38":4,"39":2,"40":0,"41":0,"42":0,"43":5,"44":5,"45":5},"f":{"0":8,"1":3,"2":0,"3":0,"4":6,"5":2,"6":4,"7":2,"8":0,"9":5},"b":{"0":[6],"1":[2,6],"2":[8,2],"3":[2,6],"4":[8,5],"5":[0],"6":[3,3],"7":[3,0],"8":[3,3],"9":[0],"10":[0,0],"11":[0],"12":[0,0],"13":[0,0],"14":[0,0],"15":[3],"16":[3,3],"17":[6,3],"18":[2,4],"19":[2],"20":[0,2],"21":[2,0],"22":[1,1],"23":[2],"24":[0],"25":[0],"26":[5,0]},"inputSourceMap":null,"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"ed85545ab6a589b822b83b8ac81af61229da0d04"}
|
|
4
|
+
,"/Users/bartmosley/Developer/thirstiedev/thirstiejs-monorepo/packages/thirstievalidators/src/iso3166codes.js": {"path":"/Users/bartmosley/Developer/thirstiedev/thirstiejs-monorepo/packages/thirstievalidators/src/iso3166codes.js","statementMap":{"0":{"start":{"line":1,"column":25},"end":{"line":53,"column":1}},"1":{"start":{"line":55,"column":28},"end":{"line":66,"column":1}},"2":{"start":{"line":69,"column":29},"end":{"line":72,"column":1}},"3":{"start":{"line":74,"column":37},"end":{"line":82,"column":1}},"4":{"start":{"line":75,"column":18},"end":{"line":75,"column":67}},"5":{"start":{"line":76,"column":24},"end":{"line":76,"column":46}},"6":{"start":{"line":77,"column":2},"end":{"line":81,"column":3}},"7":{"start":{"line":78,"column":4},"end":{"line":78,"column":52}},"8":{"start":{"line":80,"column":4},"end":{"line":80,"column":17}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":74,"column":37},"end":{"line":74,"column":38}},"loc":{"start":{"line":74,"column":68},"end":{"line":82,"column":1}},"line":74}},"branchMap":{"0":{"loc":{"start":{"line":74,"column":45},"end":{"line":74,"column":63}},"type":"default-arg","locations":[{"start":{"line":74,"column":59},"end":{"line":74,"column":63}}],"line":74},"1":{"loc":{"start":{"line":75,"column":18},"end":{"line":75,"column":67}},"type":"cond-expr","locations":[{"start":{"line":75,"column":32},"end":{"line":75,"column":57}},{"start":{"line":75,"column":60},"end":{"line":75,"column":67}}],"line":75},"2":{"loc":{"start":{"line":77,"column":2},"end":{"line":81,"column":3}},"type":"if","locations":[{"start":{"line":77,"column":2},"end":{"line":81,"column":3}},{"start":{"line":79,"column":9},"end":{"line":81,"column":3}}],"line":77}},"s":{"0":4,"1":4,"2":4,"3":4,"4":6,"5":6,"6":6,"7":6,"8":0},"f":{"0":6},"b":{"0":[0],"1":[6,0],"2":[6,0]},"inputSourceMap":null,"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"738c1098ef3f560c9f98b2616adb51dad125e82c"}
|
|
5
|
+
,"/Users/bartmosley/Developer/thirstiedev/thirstiejs-monorepo/packages/thirstievalidators/src/passwordcheck.js": {"path":"/Users/bartmosley/Developer/thirstiedev/thirstiejs-monorepo/packages/thirstievalidators/src/passwordcheck.js","statementMap":{"0":{"start":{"line":1,"column":20},"end":{"line":1,"column":35}},"1":{"start":{"line":2,"column":26},"end":{"line":2,"column":60}},"2":{"start":{"line":5,"column":20},"end":{"line":5,"column":36}},"3":{"start":{"line":6,"column":19},"end":{"line":6,"column":42}},"4":{"start":{"line":7,"column":2},"end":{"line":10,"column":4}},"5":{"start":{"line":13,"column":21},"end":{"line":22,"column":1}},"6":{"start":{"line":14,"column":29},"end":{"line":14,"column":58}},"7":{"start":{"line":15,"column":32},"end":{"line":15,"column":61}},"8":{"start":{"line":16,"column":32},"end":{"line":16,"column":61}},"9":{"start":{"line":17,"column":34},"end":{"line":17,"column":70}},"10":{"start":{"line":19,"column":23},"end":{"line":19,"column":115}},"11":{"start":{"line":20,"column":19},"end":{"line":20,"column":28}},"12":{"start":{"line":21,"column":2},"end":{"line":21,"column":45}},"13":{"start":{"line":24,"column":21},"end":{"line":29,"column":1}},"14":{"start":{"line":25,"column":14},"end":{"line":25,"column":56}},"15":{"start":{"line":25,"column":41},"end":{"line":25,"column":55}},"16":{"start":{"line":27,"column":19},"end":{"line":27,"column":47}},"17":{"start":{"line":28,"column":2},"end":{"line":28,"column":18}}},"fnMap":{"0":{"name":"passwordcheck","decl":{"start":{"line":4,"column":9},"end":{"line":4,"column":22}},"loc":{"start":{"line":4,"column":28},"end":{"line":11,"column":1}},"line":4},"1":{"name":"(anonymous_1)","decl":{"start":{"line":13,"column":21},"end":{"line":13,"column":22}},"loc":{"start":{"line":13,"column":29},"end":{"line":22,"column":1}},"line":13},"2":{"name":"(anonymous_2)","decl":{"start":{"line":24,"column":21},"end":{"line":24,"column":22}},"loc":{"start":{"line":24,"column":36},"end":{"line":29,"column":1}},"line":24},"3":{"name":"(anonymous_3)","decl":{"start":{"line":25,"column":36},"end":{"line":25,"column":37}},"loc":{"start":{"line":25,"column":41},"end":{"line":25,"column":55}},"line":25}},"branchMap":{"0":{"loc":{"start":{"line":14,"column":29},"end":{"line":14,"column":58}},"type":"cond-expr","locations":[{"start":{"line":14,"column":52},"end":{"line":14,"column":54}},{"start":{"line":14,"column":57},"end":{"line":14,"column":58}}],"line":14},"1":{"loc":{"start":{"line":15,"column":32},"end":{"line":15,"column":61}},"type":"cond-expr","locations":[{"start":{"line":15,"column":55},"end":{"line":15,"column":57}},{"start":{"line":15,"column":60},"end":{"line":15,"column":61}}],"line":15},"2":{"loc":{"start":{"line":16,"column":32},"end":{"line":16,"column":61}},"type":"cond-expr","locations":[{"start":{"line":16,"column":55},"end":{"line":16,"column":57}},{"start":{"line":16,"column":60},"end":{"line":16,"column":61}}],"line":16},"3":{"loc":{"start":{"line":17,"column":34},"end":{"line":17,"column":70}},"type":"cond-expr","locations":[{"start":{"line":17,"column":64},"end":{"line":17,"column":66}},{"start":{"line":17,"column":69},"end":{"line":17,"column":70}}],"line":17}},"s":{"0":4,"1":4,"2":2,"3":2,"4":2,"5":4,"6":2,"7":2,"8":2,"9":2,"10":2,"11":2,"12":2,"13":4,"14":2,"15":4,"16":2,"17":2},"f":{"0":2,"1":2,"2":2,"3":4},"b":{"0":[2,0],"1":[1,1],"2":[1,1],"3":[1,1]},"inputSourceMap":null,"_coverageSchema":"1a1c01bbd47fc00a2c39e90264f33305004495a9","hash":"1fca3575f9db3655bb0b30cf1dd6e21c49be8713"}
|
|
6
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
|
|
2
|
+
<!doctype html>
|
|
3
|
+
<html lang="en">
|
|
4
|
+
|
|
5
|
+
<head>
|
|
6
|
+
<title>Code coverage report for agegate.js</title>
|
|
7
|
+
<meta charset="utf-8" />
|
|
8
|
+
<link rel="stylesheet" href="prettify.css" />
|
|
9
|
+
<link rel="stylesheet" href="base.css" />
|
|
10
|
+
<link rel="shortcut icon" type="image/x-icon" href="favicon.png" />
|
|
11
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
12
|
+
<style type='text/css'>
|
|
13
|
+
.coverage-summary .sorter {
|
|
14
|
+
background-image: url(sort-arrow-sprite.png);
|
|
15
|
+
}
|
|
16
|
+
</style>
|
|
17
|
+
</head>
|
|
18
|
+
|
|
19
|
+
<body>
|
|
20
|
+
<div class='wrapper'>
|
|
21
|
+
<div class='pad1'>
|
|
22
|
+
<h1><a href="index.html">All files</a> agegate.js</h1>
|
|
23
|
+
<div class='clearfix'>
|
|
24
|
+
|
|
25
|
+
<div class='fl pad1y space-right2'>
|
|
26
|
+
<span class="strong">95% </span>
|
|
27
|
+
<span class="quiet">Statements</span>
|
|
28
|
+
<span class='fraction'>19/20</span>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
<div class='fl pad1y space-right2'>
|
|
33
|
+
<span class="strong">81.81% </span>
|
|
34
|
+
<span class="quiet">Branches</span>
|
|
35
|
+
<span class='fraction'>9/11</span>
|
|
36
|
+
</div>
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
<div class='fl pad1y space-right2'>
|
|
40
|
+
<span class="strong">100% </span>
|
|
41
|
+
<span class="quiet">Functions</span>
|
|
42
|
+
<span class='fraction'>1/1</span>
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
<div class='fl pad1y space-right2'>
|
|
47
|
+
<span class="strong">95% </span>
|
|
48
|
+
<span class="quiet">Lines</span>
|
|
49
|
+
<span class='fraction'>19/20</span>
|
|
50
|
+
</div>
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
</div>
|
|
54
|
+
<p class="quiet">
|
|
55
|
+
Press <em>n</em> or <em>j</em> to go to the next uncovered block, <em>b</em>, <em>p</em> or <em>k</em> for the previous block.
|
|
56
|
+
</p>
|
|
57
|
+
<template id="filterTemplate">
|
|
58
|
+
<div class="quiet">
|
|
59
|
+
Filter:
|
|
60
|
+
<input type="search" id="fileSearch">
|
|
61
|
+
</div>
|
|
62
|
+
</template>
|
|
63
|
+
</div>
|
|
64
|
+
<div class='status-line high'></div>
|
|
65
|
+
<pre><table class="coverage">
|
|
66
|
+
<tr><td class="line-count quiet"><a name='L1'></a><a href='#L1'>1</a>
|
|
67
|
+
<a name='L2'></a><a href='#L2'>2</a>
|
|
68
|
+
<a name='L3'></a><a href='#L3'>3</a>
|
|
69
|
+
<a name='L4'></a><a href='#L4'>4</a>
|
|
70
|
+
<a name='L5'></a><a href='#L5'>5</a>
|
|
71
|
+
<a name='L6'></a><a href='#L6'>6</a>
|
|
72
|
+
<a name='L7'></a><a href='#L7'>7</a>
|
|
73
|
+
<a name='L8'></a><a href='#L8'>8</a>
|
|
74
|
+
<a name='L9'></a><a href='#L9'>9</a>
|
|
75
|
+
<a name='L10'></a><a href='#L10'>10</a>
|
|
76
|
+
<a name='L11'></a><a href='#L11'>11</a>
|
|
77
|
+
<a name='L12'></a><a href='#L12'>12</a>
|
|
78
|
+
<a name='L13'></a><a href='#L13'>13</a>
|
|
79
|
+
<a name='L14'></a><a href='#L14'>14</a>
|
|
80
|
+
<a name='L15'></a><a href='#L15'>15</a>
|
|
81
|
+
<a name='L16'></a><a href='#L16'>16</a>
|
|
82
|
+
<a name='L17'></a><a href='#L17'>17</a>
|
|
83
|
+
<a name='L18'></a><a href='#L18'>18</a>
|
|
84
|
+
<a name='L19'></a><a href='#L19'>19</a>
|
|
85
|
+
<a name='L20'></a><a href='#L20'>20</a>
|
|
86
|
+
<a name='L21'></a><a href='#L21'>21</a>
|
|
87
|
+
<a name='L22'></a><a href='#L22'>22</a>
|
|
88
|
+
<a name='L23'></a><a href='#L23'>23</a>
|
|
89
|
+
<a name='L24'></a><a href='#L24'>24</a>
|
|
90
|
+
<a name='L25'></a><a href='#L25'>25</a>
|
|
91
|
+
<a name='L26'></a><a href='#L26'>26</a>
|
|
92
|
+
<a name='L27'></a><a href='#L27'>27</a>
|
|
93
|
+
<a name='L28'></a><a href='#L28'>28</a>
|
|
94
|
+
<a name='L29'></a><a href='#L29'>29</a>
|
|
95
|
+
<a name='L30'></a><a href='#L30'>30</a>
|
|
96
|
+
<a name='L31'></a><a href='#L31'>31</a>
|
|
97
|
+
<a name='L32'></a><a href='#L32'>32</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
98
|
+
<span class="cline-any cline-neutral"> </span>
|
|
99
|
+
<span class="cline-any cline-yes">5x</span>
|
|
100
|
+
<span class="cline-any cline-yes">8x</span>
|
|
101
|
+
<span class="cline-any cline-yes">8x</span>
|
|
102
|
+
<span class="cline-any cline-yes">8x</span>
|
|
103
|
+
<span class="cline-any cline-neutral"> </span>
|
|
104
|
+
<span class="cline-any cline-yes">8x</span>
|
|
105
|
+
<span class="cline-any cline-yes">8x</span>
|
|
106
|
+
<span class="cline-any cline-yes">8x</span>
|
|
107
|
+
<span class="cline-any cline-neutral"> </span>
|
|
108
|
+
<span class="cline-any cline-no"> </span>
|
|
109
|
+
<span class="cline-any cline-neutral"> </span>
|
|
110
|
+
<span class="cline-any cline-neutral"> </span>
|
|
111
|
+
<span class="cline-any cline-yes">8x</span>
|
|
112
|
+
<span class="cline-any cline-yes">8x</span>
|
|
113
|
+
<span class="cline-any cline-yes">8x</span>
|
|
114
|
+
<span class="cline-any cline-neutral"> </span>
|
|
115
|
+
<span class="cline-any cline-yes">5x</span>
|
|
116
|
+
<span class="cline-any cline-yes">5x</span>
|
|
117
|
+
<span class="cline-any cline-yes">5x</span>
|
|
118
|
+
<span class="cline-any cline-neutral"> </span>
|
|
119
|
+
<span class="cline-any cline-yes">3x</span>
|
|
120
|
+
<span class="cline-any cline-yes">3x</span>
|
|
121
|
+
<span class="cline-any cline-yes">3x</span>
|
|
122
|
+
<span class="cline-any cline-yes">3x</span>
|
|
123
|
+
<span class="cline-any cline-neutral"> </span>
|
|
124
|
+
<span class="cline-any cline-yes">3x</span>
|
|
125
|
+
<span class="cline-any cline-neutral"> </span>
|
|
126
|
+
<span class="cline-any cline-yes">8x</span>
|
|
127
|
+
<span class="cline-any cline-neutral"> </span>
|
|
128
|
+
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">import { z } from 'zod';
|
|
129
|
+
|
|
130
|
+
export const ageGate = (ageGateType, ageGateValue, legalAge = null) => {
|
|
131
|
+
const ageGateTypeValidation = z.enum([ 'yesno', 'dob' ]);
|
|
132
|
+
const ageDateValidation = z.coerce.date();
|
|
133
|
+
legalAge = legalAge || 21;
|
|
134
|
+
|
|
135
|
+
let _type = null;
|
|
136
|
+
try {
|
|
137
|
+
_type = ageGateTypeValidation.parse(ageGateType.toLowerCase());
|
|
138
|
+
} catch {
|
|
139
|
+
<span class="cstat-no" title="statement not covered" > return {};</span>
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
let _passed = false;
|
|
143
|
+
let { success, data: userDOB } = ageDateValidation.safeParse(ageGateValue);
|
|
144
|
+
switch (_type) {
|
|
145
|
+
case 'yesno':
|
|
146
|
+
_passed = !!ageGateValue;
|
|
147
|
+
userDOB = null;
|
|
148
|
+
break;
|
|
149
|
+
case 'dob':
|
|
150
|
+
<span class="missing-if-branch" title="else path not taken" >E</span>if (success) {
|
|
151
|
+
const today = new Date();
|
|
152
|
+
const legalAsOf = new Date(userDOB.getFullYear() + legalAge, userDOB.getMonth(), userDOB.getDate());
|
|
153
|
+
_passed = !legalAsOf ? <span class="branch-0 cbranch-no" title="branch not covered" >false </span>: legalAsOf <= today;
|
|
154
|
+
}
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
return { ageGateType: _type, ageGatePassed: _passed, ageGateDOB: userDOB || null };
|
|
158
|
+
};
|
|
159
|
+
</pre></td></tr></table></pre>
|
|
160
|
+
|
|
161
|
+
<div class='push'></div><!-- for sticky footer -->
|
|
162
|
+
</div><!-- /wrapper -->
|
|
163
|
+
<div class='footer quiet pad2 space-top1 center small'>
|
|
164
|
+
Code coverage generated by
|
|
165
|
+
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
166
|
+
at 2024-10-07T19:52:26.183Z
|
|
167
|
+
</div>
|
|
168
|
+
<script src="prettify.js"></script>
|
|
169
|
+
<script>
|
|
170
|
+
window.onload = function () {
|
|
171
|
+
prettyPrint();
|
|
172
|
+
};
|
|
173
|
+
</script>
|
|
174
|
+
<script src="sorter.js"></script>
|
|
175
|
+
<script src="block-navigation.js"></script>
|
|
176
|
+
</body>
|
|
177
|
+
</html>
|
|
178
|
+
|