@aglyn/shared-data-regex 1.0.0-beta.143 → 1.0.0-beta.144
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/README.md +44 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,3 +1,45 @@
|
|
|
1
|
-
# shared-data-regex
|
|
1
|
+
# @aglyn/shared-data-regex
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A small set of regular expressions for form validation: an email pattern and the character-class checks used for password rules. It is mainly a dependency of `@aglyn/shared-data-forms`, and has no dependencies of its own beyond the compiler helpers.
|
|
4
|
+
|
|
5
|
+
> Beta. Published from the Aglyn monorepo under the `beta` dist-tag; APIs can change between beta releases.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
npm install @aglyn/shared-data-regex@beta
|
|
10
|
+
|
|
11
|
+
No peer dependencies.
|
|
12
|
+
|
|
13
|
+
## What's in it
|
|
14
|
+
|
|
15
|
+
- `REGEX_EMAIL` — an email address pattern.
|
|
16
|
+
- `REGEX_NO_SPACES` — matches a string that contains no whitespace.
|
|
17
|
+
- `REGEX_SPECIAL_CHARACTER` — matches a non-word character.
|
|
18
|
+
- `REGEX_NUMBER` — matches a digit.
|
|
19
|
+
- `REGEX_LETTER_LOWER` — matches a lowercase ASCII letter.
|
|
20
|
+
- `REGEX_LETTER_UPPER` — matches an uppercase ASCII letter.
|
|
21
|
+
|
|
22
|
+
Entry points: `.` and `@aglyn/shared-data-regex/regex`.
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import {
|
|
28
|
+
REGEX_LETTER_UPPER,
|
|
29
|
+
REGEX_NO_SPACES,
|
|
30
|
+
REGEX_NUMBER,
|
|
31
|
+
} from '@aglyn/shared-data-regex'
|
|
32
|
+
|
|
33
|
+
const acceptable = (password: string) =>
|
|
34
|
+
REGEX_NO_SPACES.test(password) &&
|
|
35
|
+
REGEX_NUMBER.test(password) &&
|
|
36
|
+
REGEX_LETTER_UPPER.test(password)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## How it fits
|
|
40
|
+
|
|
41
|
+
A `shared` data package at the bottom of the package map. `@aglyn/shared-data-forms` builds its email and password validators from these patterns. Shared packages are generic: they import only other shared packages and hold no plugin's domain.
|
|
42
|
+
|
|
43
|
+
## License
|
|
44
|
+
|
|
45
|
+
Apache-2.0. Source: https://github.com/aglyn/aglyn/tree/main/libs/shared/data/regex
|