@sharadox/web-library 0.4.1 → 0.5.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.
- package/LICENSE.md +22 -22
- package/README.md +41 -29
- package/distribution/assert/never/index.d.ts +13 -0
- package/distribution/assert/never/index.d.ts.map +1 -0
- package/distribution/assert/never/index.js +15 -0
- package/distribution/assert/never/index.js.map +1 -0
- package/distribution/class-name/index.d.ts +6 -1
- package/distribution/class-name/index.d.ts.map +1 -1
- package/distribution/class-name/index.js +6 -1
- package/distribution/class-name/index.js.map +1 -1
- package/distribution/html/escape/index.d.ts +6 -1
- package/distribution/html/escape/index.d.ts.map +1 -1
- package/distribution/html/escape/index.js +7 -2
- package/distribution/html/escape/index.js.map +1 -1
- package/distribution/math/clamp/index.d.ts +6 -1
- package/distribution/math/clamp/index.d.ts.map +1 -1
- package/distribution/math/clamp/index.js +6 -1
- package/distribution/math/clamp/index.js.map +1 -1
- package/distribution/math/pseudo-random/index.d.ts +6 -1
- package/distribution/math/pseudo-random/index.d.ts.map +1 -1
- package/distribution/math/pseudo-random/index.js +6 -1
- package/distribution/math/pseudo-random/index.js.map +1 -1
- package/distribution/math/radians/index.d.ts +6 -1
- package/distribution/math/radians/index.d.ts.map +1 -1
- package/distribution/math/radians/index.js +6 -1
- package/distribution/math/radians/index.js.map +1 -1
- package/distribution/text/separate/index.d.ts +9 -0
- package/distribution/text/separate/index.d.ts.map +1 -0
- package/distribution/text/separate/index.js +11 -0
- package/distribution/text/separate/index.js.map +1 -0
- package/distribution/type-guard/is-boolean/index.d.ts +8 -0
- package/distribution/type-guard/is-boolean/index.d.ts.map +1 -0
- package/distribution/type-guard/is-boolean/index.js +10 -0
- package/distribution/type-guard/is-boolean/index.js.map +1 -0
- package/distribution/type-guard/is-defined/index.d.ts +8 -0
- package/distribution/type-guard/is-defined/index.d.ts.map +1 -0
- package/distribution/type-guard/is-defined/index.js +10 -0
- package/distribution/type-guard/is-defined/index.js.map +1 -0
- package/distribution/type-guard/is-non-empty-string/index.d.ts +8 -0
- package/distribution/type-guard/is-non-empty-string/index.d.ts.map +1 -0
- package/distribution/type-guard/is-non-empty-string/index.js +11 -0
- package/distribution/type-guard/is-non-empty-string/index.js.map +1 -0
- package/distribution/type-guard/is-number/index.d.ts +9 -0
- package/distribution/type-guard/is-number/index.d.ts.map +1 -0
- package/distribution/type-guard/is-number/index.js +11 -0
- package/distribution/type-guard/is-number/index.js.map +1 -0
- package/distribution/type-guard/is-record/index.d.ts +9 -0
- package/distribution/type-guard/is-record/index.d.ts.map +1 -0
- package/distribution/type-guard/is-record/index.js +14 -0
- package/distribution/type-guard/is-record/index.js.map +1 -0
- package/distribution/type-guard/is-string/index.d.ts +9 -0
- package/distribution/type-guard/is-string/index.d.ts.map +1 -0
- package/distribution/type-guard/is-string/index.js +11 -0
- package/distribution/type-guard/is-string/index.js.map +1 -0
- package/llms.txt +17 -0
- package/package.json +17 -45
- package/distribution/animation/count-up/index.d.ts +0 -6
- package/distribution/animation/count-up/index.d.ts.map +0 -1
- package/distribution/animation/count-up/index.js +0 -29
- package/distribution/animation/count-up/index.js.map +0 -1
- package/distribution/animation/in-view/index.d.ts +0 -3
- package/distribution/animation/in-view/index.d.ts.map +0 -1
- package/distribution/animation/in-view/index.js +0 -15
- package/distribution/animation/in-view/index.js.map +0 -1
- package/distribution/animation/marquee/index.d.ts +0 -9
- package/distribution/animation/marquee/index.d.ts.map +0 -1
- package/distribution/animation/marquee/index.js +0 -78
- package/distribution/animation/marquee/index.js.map +0 -1
- package/distribution/animation/marquee/type.d.ts +0 -5
- package/distribution/animation/marquee/type.d.ts.map +0 -1
- package/distribution/animation/marquee/type.js +0 -2
- package/distribution/animation/marquee/type.js.map +0 -1
- package/distribution/animation/reveal/index.d.ts +0 -4
- package/distribution/animation/reveal/index.d.ts.map +0 -1
- package/distribution/animation/reveal/index.js +0 -9
- package/distribution/animation/reveal/index.js.map +0 -1
- package/distribution/animation/reveal/type.d.ts +0 -14
- package/distribution/animation/reveal/type.d.ts.map +0 -1
- package/distribution/animation/reveal/type.js +0 -2
- package/distribution/animation/reveal/type.js.map +0 -1
- package/distribution/animation/scroll-word/index.d.ts +0 -4
- package/distribution/animation/scroll-word/index.d.ts.map +0 -1
- package/distribution/animation/scroll-word/index.js +0 -16
- package/distribution/animation/scroll-word/index.js.map +0 -1
- package/distribution/animation/scroll-word/type.d.ts +0 -11
- package/distribution/animation/scroll-word/type.d.ts.map +0 -1
- package/distribution/animation/scroll-word/type.js +0 -2
- package/distribution/animation/scroll-word/type.js.map +0 -1
- package/distribution/animation/scroll-word/word/index.d.ts +0 -4
- package/distribution/animation/scroll-word/word/index.d.ts.map +0 -1
- package/distribution/animation/scroll-word/word/index.js +0 -10
- package/distribution/animation/scroll-word/word/index.js.map +0 -1
- package/distribution/animation/scroll-word/word/type.d.ts +0 -14
- package/distribution/animation/scroll-word/word/type.d.ts.map +0 -1
- package/distribution/animation/scroll-word/word/type.js +0 -2
- package/distribution/animation/scroll-word/word/type.js.map +0 -1
- package/distribution/animation/smooth-scroll/index.d.ts +0 -4
- package/distribution/animation/smooth-scroll/index.d.ts.map +0 -1
- package/distribution/animation/smooth-scroll/index.js +0 -33
- package/distribution/animation/smooth-scroll/index.js.map +0 -1
- package/distribution/animation/smooth-scroll/type.d.ts +0 -7
- package/distribution/animation/smooth-scroll/type.d.ts.map +0 -1
- package/distribution/animation/smooth-scroll/type.js +0 -2
- package/distribution/animation/smooth-scroll/type.js.map +0 -1
- package/distribution/form/bot-check/index.d.ts +0 -4
- package/distribution/form/bot-check/index.d.ts.map +0 -1
- package/distribution/form/bot-check/index.js +0 -6
- package/distribution/form/bot-check/index.js.map +0 -1
- package/distribution/form/bot-check/type.d.ts +0 -11
- package/distribution/form/bot-check/type.d.ts.map +0 -1
- package/distribution/form/bot-check/type.js +0 -2
- package/distribution/form/bot-check/type.js.map +0 -1
- package/distribution/form/field/index.d.ts +0 -3
- package/distribution/form/field/index.d.ts.map +0 -1
- package/distribution/form/field/index.js +0 -7
- package/distribution/form/field/index.js.map +0 -1
- package/distribution/form/rate-limit/index.d.ts +0 -4
- package/distribution/form/rate-limit/index.d.ts.map +0 -1
- package/distribution/form/rate-limit/index.js +0 -14
- package/distribution/form/rate-limit/index.js.map +0 -1
- package/distribution/form/rate-limit/type.d.ts +0 -9
- package/distribution/form/rate-limit/type.d.ts.map +0 -1
- package/distribution/form/rate-limit/type.js +0 -2
- package/distribution/form/rate-limit/type.js.map +0 -1
- package/distribution/internationalization/locale/index.d.ts +0 -7
- package/distribution/internationalization/locale/index.d.ts.map +0 -1
- package/distribution/internationalization/locale/index.js +0 -17
- package/distribution/internationalization/locale/index.js.map +0 -1
- package/distribution/internationalization/locale/type.d.ts +0 -3
- package/distribution/internationalization/locale/type.d.ts.map +0 -1
- package/distribution/internationalization/locale/type.js +0 -2
- package/distribution/internationalization/locale/type.js.map +0 -1
- package/distribution/internationalization/locale-preference/index.d.ts +0 -5
- package/distribution/internationalization/locale-preference/index.d.ts.map +0 -1
- package/distribution/internationalization/locale-preference/index.js +0 -9
- package/distribution/internationalization/locale-preference/index.js.map +0 -1
- package/distribution/internationalization/locale-redirect/index.d.ts +0 -8
- package/distribution/internationalization/locale-redirect/index.d.ts.map +0 -1
- package/distribution/internationalization/locale-redirect/index.js +0 -24
- package/distribution/internationalization/locale-redirect/index.js.map +0 -1
- package/distribution/internationalization/locale-redirect/type.d.ts +0 -12
- package/distribution/internationalization/locale-redirect/type.d.ts.map +0 -1
- package/distribution/internationalization/locale-redirect/type.js +0 -2
- package/distribution/internationalization/locale-redirect/type.js.map +0 -1
- package/distribution/internationalization/translate/index.d.ts +0 -4
- package/distribution/internationalization/translate/index.d.ts.map +0 -1
- package/distribution/internationalization/translate/index.js +0 -5
- package/distribution/internationalization/translate/index.js.map +0 -1
- package/distribution/pointer/spotlight/index.d.ts +0 -3
- package/distribution/pointer/spotlight/index.d.ts.map +0 -1
- package/distribution/pointer/spotlight/index.js +0 -20
- package/distribution/pointer/spotlight/index.js.map +0 -1
- package/distribution/pointer/tilt/index.d.ts +0 -7
- package/distribution/pointer/tilt/index.d.ts.map +0 -1
- package/distribution/pointer/tilt/index.js +0 -34
- package/distribution/pointer/tilt/index.js.map +0 -1
- package/distribution/privacy/consent/index.d.ts +0 -22
- package/distribution/privacy/consent/index.d.ts.map +0 -1
- package/distribution/privacy/consent/index.js +0 -75
- package/distribution/privacy/consent/index.js.map +0 -1
- package/distribution/privacy/consent/type.d.ts +0 -35
- package/distribution/privacy/consent/type.d.ts.map +0 -1
- package/distribution/privacy/consent/type.js +0 -2
- package/distribution/privacy/consent/type.js.map +0 -1
- package/distribution/privacy/use-consent/index.d.ts +0 -5
- package/distribution/privacy/use-consent/index.d.ts.map +0 -1
- package/distribution/privacy/use-consent/index.js +0 -22
- package/distribution/privacy/use-consent/index.js.map +0 -1
- package/distribution/privacy/use-consent/type.d.ts +0 -10
- package/distribution/privacy/use-consent/type.d.ts.map +0 -1
- package/distribution/privacy/use-consent/type.js +0 -2
- package/distribution/privacy/use-consent/type.js.map +0 -1
- package/distribution/scroll/active-section/index.d.ts +0 -7
- package/distribution/scroll/active-section/index.d.ts.map +0 -1
- package/distribution/scroll/active-section/index.js +0 -49
- package/distribution/scroll/active-section/index.js.map +0 -1
- package/distribution/scroll/active-section/type.d.ts +0 -9
- package/distribution/scroll/active-section/type.d.ts.map +0 -1
- package/distribution/scroll/active-section/type.js +0 -2
- package/distribution/scroll/active-section/type.js.map +0 -1
- package/distribution/search-engine/robots/index.d.ts +0 -4
- package/distribution/search-engine/robots/index.d.ts.map +0 -1
- package/distribution/search-engine/robots/index.js +0 -7
- package/distribution/search-engine/robots/index.js.map +0 -1
- package/distribution/search-engine/robots/type.d.ts +0 -17
- package/distribution/search-engine/robots/type.d.ts.map +0 -1
- package/distribution/search-engine/robots/type.js +0 -2
- package/distribution/search-engine/robots/type.js.map +0 -1
- package/distribution/search-engine/sitemap/index.d.ts +0 -4
- package/distribution/search-engine/sitemap/index.d.ts.map +0 -1
- package/distribution/search-engine/sitemap/index.js +0 -12
- package/distribution/search-engine/sitemap/index.js.map +0 -1
- package/distribution/search-engine/sitemap/type.d.ts +0 -22
- package/distribution/search-engine/sitemap/type.d.ts.map +0 -1
- package/distribution/search-engine/sitemap/type.js +0 -2
- package/distribution/search-engine/sitemap/type.js.map +0 -1
- package/distribution/search-engine/structured-data/index.d.ts +0 -4
- package/distribution/search-engine/structured-data/index.d.ts.map +0 -1
- package/distribution/search-engine/structured-data/index.js +0 -6
- package/distribution/search-engine/structured-data/index.js.map +0 -1
- package/distribution/search-engine/structured-data/type.d.ts +0 -5
- package/distribution/search-engine/structured-data/type.d.ts.map +0 -1
- package/distribution/search-engine/structured-data/type.js +0 -2
- package/distribution/search-engine/structured-data/type.js.map +0 -1
- package/distribution/style/apply/index.d.ts +0 -11
- package/distribution/style/apply/index.d.ts.map +0 -1
- package/distribution/style/apply/index.js +0 -50
- package/distribution/style/apply/index.js.map +0 -1
- package/distribution/style/apply/type.d.ts +0 -12
- package/distribution/style/apply/type.d.ts.map +0 -1
- package/distribution/style/apply/type.js +0 -2
- package/distribution/style/apply/type.js.map +0 -1
- package/distribution/style/definition/index.d.ts +0 -14
- package/distribution/style/definition/index.d.ts.map +0 -1
- package/distribution/style/definition/index.js +0 -26
- package/distribution/style/definition/index.js.map +0 -1
- package/distribution/style/definition/type.d.ts +0 -29
- package/distribution/style/definition/type.d.ts.map +0 -1
- package/distribution/style/definition/type.js +0 -2
- package/distribution/style/definition/type.js.map +0 -1
- package/distribution/style/style-script/index.d.ts +0 -10
- package/distribution/style/style-script/index.d.ts.map +0 -1
- package/distribution/style/style-script/index.js +0 -16
- package/distribution/style/style-script/index.js.map +0 -1
- package/distribution/style/style-script/type.d.ts +0 -5
- package/distribution/style/style-script/type.d.ts.map +0 -1
- package/distribution/style/style-script/type.js +0 -2
- package/distribution/style/style-script/type.js.map +0 -1
- package/distribution/style/style-sheet/index.d.ts +0 -8
- package/distribution/style/style-sheet/index.d.ts.map +0 -1
- package/distribution/style/style-sheet/index.js +0 -25
- package/distribution/style/style-sheet/index.js.map +0 -1
- package/distribution/style/use-style/index.d.ts +0 -5
- package/distribution/style/use-style/index.d.ts.map +0 -1
- package/distribution/style/use-style/index.js +0 -37
- package/distribution/style/use-style/index.js.map +0 -1
- package/distribution/style/use-style/type.d.ts +0 -9
- package/distribution/style/use-style/type.d.ts.map +0 -1
- package/distribution/style/use-style/type.js +0 -2
- package/distribution/style/use-style/type.js.map +0 -1
- package/distribution/test/visual-snapshot/index.d.ts +0 -8
- package/distribution/test/visual-snapshot/index.d.ts.map +0 -1
- package/distribution/test/visual-snapshot/index.js +0 -20
- package/distribution/test/visual-snapshot/index.js.map +0 -1
- package/distribution/test/visual-snapshot/type.d.ts +0 -7
- package/distribution/test/visual-snapshot/type.d.ts.map +0 -1
- package/distribution/test/visual-snapshot/type.js +0 -2
- package/distribution/test/visual-snapshot/type.js.map +0 -1
- package/distribution/time/format-time/index.d.ts +0 -3
- package/distribution/time/format-time/index.d.ts.map +0 -1
- package/distribution/time/format-time/index.js +0 -5
- package/distribution/time/format-time/index.js.map +0 -1
- package/distribution/time/open-state/index.d.ts +0 -4
- package/distribution/time/open-state/index.d.ts.map +0 -1
- package/distribution/time/open-state/index.js +0 -11
- package/distribution/time/open-state/index.js.map +0 -1
- package/distribution/time/open-state/type.d.ts +0 -5
- package/distribution/time/open-state/type.d.ts.map +0 -1
- package/distribution/time/open-state/type.js +0 -2
- package/distribution/time/open-state/type.js.map +0 -1
- package/distribution/time/sun-time/index.d.ts +0 -4
- package/distribution/time/sun-time/index.d.ts.map +0 -1
- package/distribution/time/sun-time/index.js +0 -27
- package/distribution/time/sun-time/index.js.map +0 -1
- package/distribution/time/sun-time/type.d.ts +0 -6
- package/distribution/time/sun-time/type.d.ts.map +0 -1
- package/distribution/time/sun-time/type.js +0 -2
- package/distribution/time/sun-time/type.js.map +0 -1
- package/distribution/time/sun-today/index.d.ts +0 -4
- package/distribution/time/sun-today/index.d.ts.map +0 -1
- package/distribution/time/sun-today/index.js +0 -25
- package/distribution/time/sun-today/index.js.map +0 -1
- package/distribution/time/sun-today/type.d.ts +0 -9
- package/distribution/time/sun-today/type.d.ts.map +0 -1
- package/distribution/time/sun-today/type.js +0 -2
- package/distribution/time/sun-today/type.js.map +0 -1
- package/distribution/time/zone-minute/index.d.ts +0 -3
- package/distribution/time/zone-minute/index.d.ts.map +0 -1
- package/distribution/time/zone-minute/index.js +0 -13
- package/distribution/time/zone-minute/index.js.map +0 -1
package/LICENSE.md
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
# Sharadox Open Source
|
|
1
|
+
# Sharadox Open Source License
|
|
2
2
|
|
|
3
3
|
Version 0.1.0
|
|
4
4
|
|
|
5
|
-
This is an informative English translation. The Portuguese text (`LICENCA.md`) is the only original and binding text of this
|
|
5
|
+
This is an informative English translation. The Portuguese text (`LICENCA.md`) is the only original and binding text of this license; if the two differ, the Portuguese text prevails.
|
|
6
6
|
|
|
7
7
|
## 1. Definitions
|
|
8
8
|
|
|
9
|
-
For the purposes of this
|
|
9
|
+
For the purposes of this license:
|
|
10
10
|
|
|
11
|
-
1. **"Work"** — the computer program, its documentation and any other content made available by the Licensor under this
|
|
11
|
+
1. **"Work"** — the computer program, its documentation and any other content made available by the Licensor under this license, in source code or in any other form.
|
|
12
12
|
2. **"Licensor"** — the copyright holder identified in the copyright notice that accompanies the Work.
|
|
13
|
-
3. **"Licensee"** — any natural or legal person exercising the rights granted by this
|
|
13
|
+
3. **"Licensee"** — any natural or legal person exercising the rights granted by this license.
|
|
14
14
|
4. **"Derivative Work"** — any work based on or incorporating the Work, in whole or in part, with or without modifications, including translations, adaptations and programs that integrate it.
|
|
15
|
-
5. **"Notice"** — the Licensor's copyright notice and the statement that the Work is licensed under this
|
|
15
|
+
5. **"Notice"** — the Licensor's copyright notice and the statement that the Work is licensed under this license, including its version.
|
|
16
16
|
|
|
17
17
|
## 2. Grant of rights
|
|
18
18
|
|
|
19
|
-
1. Under this
|
|
19
|
+
1. Under this license, the Licensor grants the Licensee a worldwide, royalty-free, non-exclusive license, for the whole term of copyright protection, to:
|
|
20
20
|
1. use the Work for any purpose, including commercial purposes;
|
|
21
21
|
2. reproduce the Work, in whole or in part, by any means and in any form;
|
|
22
22
|
3. modify, translate, adapt and transform the Work and create Derivative Works;
|
|
23
23
|
4. distribute, publish, communicate to the public, make available, sell and sublicense the Work and Derivative Works.
|
|
24
|
-
2. To the extent the Licensor holds patents necessarily infringed by the Work as made available by it, the Licensor also grants the Licensee, on the same terms, a
|
|
25
|
-
3. This
|
|
24
|
+
2. To the extent the Licensor holds patents necessarily infringed by the Work as made available by it, the Licensor also grants the Licensee, on the same terms, a license to use those patents in exercising the rights in the previous paragraph.
|
|
25
|
+
3. This license does not transfer ownership of any rights, which remain with the Licensor.
|
|
26
26
|
|
|
27
27
|
## 3. Conditions
|
|
28
28
|
|
|
29
29
|
The exercise of the rights granted is subject to the following conditions:
|
|
30
30
|
|
|
31
|
-
1. Every copy of the Work, or of substantial parts of it, and every distributed Derivative Work must include the Notice and a copy of this
|
|
31
|
+
1. Every copy of the Work, or of substantial parts of it, and every distributed Derivative Work must include the Notice and a copy of this license or a stable link to its text.
|
|
32
32
|
2. Anyone distributing a modified version of the Work must state visibly that it has been modified and may not present it as the Licensor's original version.
|
|
33
|
-
3. The Licensee may license their own modifications under other terms, provided the part of the Work included in them remains subject to the conditions of this
|
|
33
|
+
3. The Licensee may license their own modifications under other terms, provided the part of the Work included in them remains subject to the conditions of this license.
|
|
34
34
|
|
|
35
35
|
## 4. Names and trademarks
|
|
36
36
|
|
|
37
|
-
This
|
|
37
|
+
This license grants no rights to the Licensor's name, trademarks, logos or other distinctive signs, including the name "Sharadox", except as strictly necessary to comply with the duty to include the Notice. Using them to promote or suggest the Licensor's endorsement of Derivative Works or of any products or services without prior written permission is prohibited.
|
|
38
38
|
|
|
39
39
|
## 5. Disclaimer of warranties
|
|
40
40
|
|
|
@@ -43,29 +43,29 @@ The Work is provided "as is" and "as available", without any warranty, express o
|
|
|
43
43
|
## 6. Limitation of liability
|
|
44
44
|
|
|
45
45
|
1. To the maximum extent permitted by applicable law, the Licensor is not liable for any damages, direct or indirect, including loss of profits, loss of data or business interruption, arising from the use of or inability to use the Work, even if advised of the possibility of such damages.
|
|
46
|
-
2. Nothing in this
|
|
46
|
+
2. Nothing in this license excludes or limits the Licensor's liability where such exclusion or limitation is not permitted by law, in particular for acts committed with intent or gross negligence, under article 809 and article 800(2) of the Portuguese Civil Code, nor does it affect rights that the law mandatorily grants to consumers.
|
|
47
47
|
|
|
48
48
|
## 7. Termination
|
|
49
49
|
|
|
50
|
-
1. The rights granted by this
|
|
50
|
+
1. The rights granted by this license terminate automatically if the Licensee breaches any of its conditions.
|
|
51
51
|
2. The rights are reinstated if the breach is remedied within 30 days of the Licensee becoming aware of it, unless the Licensor has meanwhile objected in writing.
|
|
52
|
-
3. Termination does not affect
|
|
52
|
+
3. Termination does not affect licenses validly granted by the Licensee to third parties who comply with this license.
|
|
53
53
|
|
|
54
54
|
## 8. Governing law and jurisdiction
|
|
55
55
|
|
|
56
|
-
1. This
|
|
57
|
-
2. The Judicial Court of the District of Faro has jurisdiction over any dispute arising from this
|
|
56
|
+
1. This license is governed by Portuguese law, in particular the Code of Copyright and Related Rights, approved by Decree-Law no. 63/85 of 14 March, and Decree-Law no. 252/94 of 20 October on the legal protection of computer programs.
|
|
57
|
+
2. The Judicial Court of the District of Faro has jurisdiction over any dispute arising from this license, without prejudice to applicable mandatory rules of jurisdiction, in particular those protecting consumers.
|
|
58
58
|
|
|
59
|
-
## 9.
|
|
59
|
+
## 9. License versions
|
|
60
60
|
|
|
61
|
-
The Licensor may publish new versions of this
|
|
61
|
+
The Licensor may publish new versions of this license, identified by a version number. The Work is subject to the version stated in the Notice. If the Notice allows it, the Licensee may choose any later version.
|
|
62
62
|
|
|
63
63
|
## 10. Final provisions
|
|
64
64
|
|
|
65
|
-
1. If any provision of this
|
|
66
|
-
2. Failure to enforce any provision of this
|
|
65
|
+
1. If any provision of this license is held invalid or unenforceable, the remaining provisions stay in force, and the affected provision shall be interpreted as closely as possible to its original intent.
|
|
66
|
+
2. Failure to enforce any provision of this license at any time does not waive the right to enforce it later.
|
|
67
67
|
|
|
68
|
-
## How to apply this
|
|
68
|
+
## How to apply this license
|
|
69
69
|
|
|
70
70
|
Include in the Work a `LICENCA.md` file with the Portuguese text, this translation as `LICENSE.md`, and the following notice, filling in the year and holder:
|
|
71
71
|
|
package/README.md
CHANGED
|
@@ -1,40 +1,52 @@
|
|
|
1
1
|
# @sharadox/web-library
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The small, general utilities every Sharadox library and application imports, so even one-liners are written once: type guards, class names, HTML escaping, joining labels, math helpers and exhaustiveness checks. No dependencies.
|
|
4
|
+
|
|
5
|
+
Topic code lives in its own libraries. This package used to hold it up to version 0.4. Each topic's new home:
|
|
6
|
+
|
|
7
|
+
| Topic | Library |
|
|
8
|
+
| ----------------------------------------------------------------------- | -------------------------------------------- |
|
|
9
|
+
| Languages, translations, locale redirects and links | `@sharadox/internationalization-web-library` |
|
|
10
|
+
| Page metadata, sitemap, robots, manifest, structured data, share images | `@sharadox/metadata-web-library` |
|
|
11
|
+
| Styles (themes) | `@sharadox/style-web-library` |
|
|
12
|
+
| Cookie consent | `@sharadox/consent-web-library` |
|
|
13
|
+
| Reveal, scroll-lit words, in-view, count-up, marquee | `@sharadox/animation-web-library` |
|
|
14
|
+
| Smooth scrolling, active section | `@sharadox/scroll-web-library` |
|
|
15
|
+
| Spotlight, tilt, custom cursor | `@sharadox/pointer-web-library` |
|
|
16
|
+
| Bot checks, rate limit, contact forms | `@sharadox/form-web-library` |
|
|
17
|
+
| Time zones, opening hours, sunrise and sunset | `@sharadox/time-web-library` |
|
|
18
|
+
| Playwright helpers and shared test suites | `@sharadox/test-web-library` |
|
|
19
|
+
|
|
20
|
+
## Install
|
|
4
21
|
|
|
5
22
|
```sh
|
|
6
23
|
pnpm add @sharadox/web-library
|
|
7
24
|
```
|
|
8
25
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
|
14
|
-
|
|
|
15
|
-
| `
|
|
16
|
-
| `
|
|
17
|
-
| `
|
|
18
|
-
| `
|
|
19
|
-
| `
|
|
20
|
-
| `
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
24
|
-
| `
|
|
25
|
-
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
import { Reveal } from "@sharadox/web-library/animation/reveal";
|
|
29
|
-
import { translate } from "@sharadox/web-library/internationalization/translate";
|
|
30
|
-
|
|
31
|
-
<Reveal delay={0.1}>{translate({ en: "Hello", pt: "Olá" }, locale)}</Reveal>;
|
|
32
|
-
```
|
|
26
|
+
## API
|
|
27
|
+
|
|
28
|
+
Import each utility by its path:
|
|
29
|
+
|
|
30
|
+
| Import | Export | Example |
|
|
31
|
+
| -------------------------------------------- | ------------------------------------------------- | ---------------------------------------------------- |
|
|
32
|
+
| `@sharadox/web-library/type-guard/is-string` | `isString(value)` | `isString("a") // true` |
|
|
33
|
+
| `…/type-guard/is-non-empty-string` | `isNonEmptyString(value)` | `isNonEmptyString("") // false` |
|
|
34
|
+
| `…/type-guard/is-number` | `isNumber(value)`: finite numbers only | `isNumber(NaN) // false` |
|
|
35
|
+
| `…/type-guard/is-boolean` | `isBoolean(value)` | `isBoolean(false) // true` |
|
|
36
|
+
| `…/type-guard/is-record` | `isRecord(value)`: plain objects only | `isRecord([]) // false` |
|
|
37
|
+
| `…/type-guard/is-defined` | `isDefined(value)`: not `null`/`undefined` | `[1, undefined].filter(isDefined) // [1]` |
|
|
38
|
+
| `…/class-name` | `classNames(...names)` | `classNames("a", false, "b") // "a b"` |
|
|
39
|
+
| `…/html/escape` | `escapeHtml(text)` | `escapeHtml("<b>") // "<b>"` |
|
|
40
|
+
| `…/text/separate` | `separate(separator, ...parts)` | `separate("•", "Contact", "Ana") // "Contact • Ana"` |
|
|
41
|
+
| `…/math/clamp` | `clamp(value, minimum, maximum)` | `clamp(5, 0, 1) // 1` |
|
|
42
|
+
| `…/math/radians` | `radians(degrees)` | `radians(180) // Math.PI` |
|
|
43
|
+
| `…/math/pseudo-random` | `pseudoRandom(seed)`: repeatable number in [0, 1) | `pseudoRandom(3) === pseudoRandom(3)` |
|
|
44
|
+
| `…/assert/never` | `assertNever(value)`: exhaustive `switch` checks | `default: return assertNever(kind)` |
|
|
33
45
|
|
|
34
|
-
|
|
46
|
+
## Develop
|
|
35
47
|
|
|
36
|
-
|
|
48
|
+
Every function is tested at 100% coverage (`pnpm test:unit`). `pnpm verify` runs formatting, lint, type-check, tests and the build. Branches follow `<feature>.development` → `development` → `index`, and releases are `v<version>` tags on `index`.
|
|
37
49
|
|
|
38
|
-
##
|
|
50
|
+
## License
|
|
39
51
|
|
|
40
|
-
Licença Sharadox de Código Aberto, versão 0.1.0
|
|
52
|
+
Licença Sharadox de Código Aberto, versão 0.1.0. See [português](LICENCA.md) (the binding text) and the [English translation](LICENSE.md).
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marks code that can't be reached when every case of a union is handled: TypeScript reports an error if a case
|
|
3
|
+
* is added and forgotten, and calling it at run time throws.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* switch (kind) {
|
|
7
|
+
* case "a": return 1;
|
|
8
|
+
* case "b": return 2;
|
|
9
|
+
* default: return assertNever(kind);
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
export declare function assertNever(value: never): never;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/assert/never/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,GAAG,KAAK,CAE/C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Marks code that can't be reached when every case of a union is handled: TypeScript reports an error if a case
|
|
3
|
+
* is added and forgotten, and calling it at run time throws.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* switch (kind) {
|
|
7
|
+
* case "a": return 1;
|
|
8
|
+
* case "b": return 2;
|
|
9
|
+
* default: return assertNever(kind);
|
|
10
|
+
* }
|
|
11
|
+
*/
|
|
12
|
+
export function assertNever(value) {
|
|
13
|
+
throw new Error(`Unexpected value: ${JSON.stringify(value)}`);
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/assert/never/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,WAAW,CAAC,KAAY;IACtC,MAAM,IAAI,KAAK,CAAC,qBAAqB,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AAChE,CAAC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Joins the class names that are set, skipping `false`, `null`, `undefined` and empty strings.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* classNames("button", isActive && "active", undefined); // "button active" or "button"
|
|
6
|
+
*/
|
|
2
7
|
export declare function classNames(...names: (string | false | null | undefined)[]): string;
|
|
3
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/class-name/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/class-name/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GAAG,MAAM,CAElF"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Joins the class names that are set, skipping `false`, `null`, `undefined` and empty strings.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* classNames("button", isActive && "active", undefined); // "button active" or "button"
|
|
6
|
+
*/
|
|
2
7
|
export function classNames(...names) {
|
|
3
8
|
return names.filter(Boolean).join(" ");
|
|
4
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/class-name/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/class-name/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,GAAG,KAA4C;IACxE,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Escapes text for safe use inside HTML, for example user input in an email body.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* escapeHtml(`<b>"Tom" & 'Jerry'</b>`); // "<b>"Tom" & 'Jerry'</b>"
|
|
6
|
+
*/
|
|
2
7
|
export declare function escapeHtml(text: string): string;
|
|
3
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/html/escape/index.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/html/escape/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
const ENTITIES = { "&": "&", "<": "<", ">": ">", '"': """, "'": "'" };
|
|
2
|
-
/**
|
|
2
|
+
/**
|
|
3
|
+
* Escapes text for safe use inside HTML, for example user input in an email body.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* escapeHtml(`<b>"Tom" & 'Jerry'</b>`); // "<b>"Tom" & 'Jerry'</b>"
|
|
7
|
+
*/
|
|
3
8
|
export function escapeHtml(text) {
|
|
4
|
-
return text.replace(/[&<>"']/g, (character) => ENTITIES[character]
|
|
9
|
+
return text.replace(/[&<>"']/g, (character) => ENTITIES[character]);
|
|
5
10
|
}
|
|
6
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/html/escape/index.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/html/escape/index.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,EAAE,OAAO,EAAW,CAAC;AAElG;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,SAAS,EAAE,EAAE,CAAC,QAAQ,CAAC,SAAkC,CAAC,CAAC,CAAC;AAC/F,CAAC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Keeps a value between a minimum and a maximum.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* clamp(5, 0, 1); // 1
|
|
6
|
+
*/
|
|
2
7
|
export declare function clamp(value: number, minimum: number, maximum: number): number;
|
|
3
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/math/clamp/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/math/clamp/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAE7E"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Keeps a value between a minimum and a maximum.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* clamp(5, 0, 1); // 1
|
|
6
|
+
*/
|
|
2
7
|
export function clamp(value, minimum, maximum) {
|
|
3
8
|
return Math.min(maximum, Math.max(minimum, value));
|
|
4
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/math/clamp/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/math/clamp/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,KAAa,EAAE,OAAe,EAAE,OAAe;IACnE,OAAO,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,GAAG,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;AACrD,CAAC"}
|
|
@@ -1,3 +1,8 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* A deterministic number in [0, 1) for a seed: the same seed always gives the same value, so renders are stable.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* pseudoRandom(3) === pseudoRandom(3); // true
|
|
6
|
+
*/
|
|
2
7
|
export declare function pseudoRandom(seed: number): number;
|
|
3
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/math/pseudo-random/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/math/pseudo-random/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGjD"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* A deterministic number in [0, 1) for a seed: the same seed always gives the same value, so renders are stable.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* pseudoRandom(3) === pseudoRandom(3); // true
|
|
6
|
+
*/
|
|
2
7
|
export function pseudoRandom(seed) {
|
|
3
8
|
const value = Math.sin(seed * 12.9898) * 43758.5453;
|
|
4
9
|
return value - Math.floor(value);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/math/pseudo-random/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/math/pseudo-random/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAAC,IAAY;IACvC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,UAAU,CAAC;IACpD,OAAO,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;AACnC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/math/radians/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/math/radians/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/math/radians/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/math/radians/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,OAAe;IACrC,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,CAAC;AACnC,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Joins the parts that are set with a separator surrounded by spaces, skipping `false`, `null`, `undefined` and empty
|
|
3
|
+
* strings. Brands keep their separator in one constant and pass it here.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* separate("•", "Contact", "Ana", undefined); // "Contact • Ana"
|
|
7
|
+
*/
|
|
8
|
+
export declare function separate(separator: string, ...parts: (string | false | null | undefined)[]): string;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/text/separate/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,CAAC,MAAM,GAAG,KAAK,GAAG,IAAI,GAAG,SAAS,CAAC,EAAE,GAAG,MAAM,CAEnG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Joins the parts that are set with a separator surrounded by spaces, skipping `false`, `null`, `undefined` and empty
|
|
3
|
+
* strings. Brands keep their separator in one constant and pass it here.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* separate("•", "Contact", "Ana", undefined); // "Contact • Ana"
|
|
7
|
+
*/
|
|
8
|
+
export function separate(separator, ...parts) {
|
|
9
|
+
return parts.filter(Boolean).join(` ${separator} `);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/text/separate/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,SAAiB,EAAE,GAAG,KAA4C;IACzF,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,SAAS,GAAG,CAAC,CAAC;AACtD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/type-guard/is-boolean/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,OAAO,CAE1D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/type-guard/is-boolean/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,OAAO,OAAO,KAAK,KAAK,SAAS,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a value is neither `undefined` nor `null`. Handy with `filter` to narrow arrays.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* [1, undefined, 2].filter(isDefined); // [1, 2] as number[]
|
|
6
|
+
*/
|
|
7
|
+
export declare function isDefined<Value>(value: Value): value is NonNullable<Value>;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/type-guard/is-defined/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,GAAG,KAAK,IAAI,WAAW,CAAC,KAAK,CAAC,CAE1E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a value is neither `undefined` nor `null`. Handy with `filter` to narrow arrays.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* [1, undefined, 2].filter(isDefined); // [1, 2] as number[]
|
|
6
|
+
*/
|
|
7
|
+
export function isDefined(value) {
|
|
8
|
+
return value !== undefined && value !== null;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/type-guard/is-defined/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAQ,KAAY;IAC3C,OAAO,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/type-guard/is-non-empty-string/index.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAEhE"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { isString } from "@sharadox/web-library/type-guard/is-string";
|
|
2
|
+
/**
|
|
3
|
+
* Whether a value is a string with at least one character.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* isNonEmptyString(""); // false
|
|
7
|
+
*/
|
|
8
|
+
export function isNonEmptyString(value) {
|
|
9
|
+
return isString(value) && value.length > 0;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/type-guard/is-non-empty-string/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4CAA4C,CAAC;AAEtE;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAc;IAC7C,OAAO,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/type-guard/is-number/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a value is a finite number (not `NaN`, not `Infinity`).
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* isNumber(1.5); // true
|
|
6
|
+
* isNumber(Number.NaN); // false
|
|
7
|
+
*/
|
|
8
|
+
export function isNumber(value) {
|
|
9
|
+
return typeof value === "number" && Number.isFinite(value);
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/type-guard/is-number/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AAC7D,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a value is a plain object (an object literal or `Object.create(null)`), not an array, a date or `null`.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* isRecord({ a: 1 }); // true
|
|
6
|
+
* isRecord([]); // false
|
|
7
|
+
*/
|
|
8
|
+
export declare function isRecord(value: unknown): value is Record<string, unknown>;
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/type-guard/is-record/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAIzE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a value is a plain object (an object literal or `Object.create(null)`), not an array, a date or `null`.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* isRecord({ a: 1 }); // true
|
|
6
|
+
* isRecord([]); // false
|
|
7
|
+
*/
|
|
8
|
+
export function isRecord(value) {
|
|
9
|
+
if (typeof value !== "object" || value === null)
|
|
10
|
+
return false;
|
|
11
|
+
const prototype = Object.getPrototypeOf(value);
|
|
12
|
+
return prototype === Object.prototype || prototype === null;
|
|
13
|
+
}
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../source/type-guard/is-record/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAc;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,KAAK,CAAC;IAC9D,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAY,CAAC;IAC1D,OAAO,SAAS,KAAK,MAAM,CAAC,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC;AAC9D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../source/type-guard/is-string/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,MAAM,CAExD"}
|