@scaleway/regex 2.1.0 → 2.2.3

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 CHANGED
@@ -3,6 +3,40 @@
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
+ ### 2.2.3 (2022-04-26)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * **regex:** improve url regex ([#736](https://github.com/scaleway/scaleway-lib/issues/736)) ([c340227](https://github.com/scaleway/scaleway-lib/commit/c340227da34141c978237e7659404df84e680d7a))
12
+
13
+
14
+
15
+ ### 2.2.2 (2022-04-05)
16
+
17
+ **Note:** Version bump only for package @scaleway/regex
18
+
19
+
20
+
21
+
22
+
23
+ ### 2.2.1 (2022-03-11)
24
+
25
+ **Note:** Version bump only for package @scaleway/regex
26
+
27
+
28
+
29
+
30
+
31
+ ## 2.2.0 (2022-01-19)
32
+
33
+
34
+ ### Features
35
+
36
+ * add alphaLower and basicDomain regex ([#600](https://github.com/scaleway/scaleway-lib/issues/600)) ([418bda9](https://github.com/scaleway/scaleway-lib/commit/418bda9db7c3c342565e01433461d78079bb1b76))
37
+
38
+
39
+
6
40
  ## 2.1.0 (2021-11-23)
7
41
 
8
42
 
package/README.md CHANGED
@@ -7,14 +7,13 @@ A tiny utility to use named regex
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- $ yarn add @scaleway/regex
10
+ $ pnpm add @scaleway/regex
11
11
  ```
12
12
 
13
13
  ## Usage
14
14
 
15
15
  ```js
16
- import { fourDigitsCode } from '@scaleway/regex'
16
+ import { fourDigitsCode } from '@scaleway/regex'
17
17
 
18
18
  const isFourDigit = fourDigitsCode.test('1234')
19
-
20
19
  ```
@@ -1,4 +1,5 @@
1
1
  const alpha = /^[a-zA-Z]*$/;
2
+ const alphaLower = /^[a-z]+$/;
2
3
  const alphanum = /^[a-zA-Z0-9]*$/;
3
4
  const alphanumdash = /^[a-zA-Z0-9-]*$/;
4
5
  const alphanumdashdots = /^[a-zA-Z0-9-.]*$/;
@@ -11,20 +12,19 @@ const alphanumLowercase = /^[a-z0-9]+$/;
11
12
  const alphanumSpacesDotsUnderscoreDash = /^[a-zA-Z0-9-.\s_]*$/;
12
13
  const alphanumUnderscoreDash = /^[a-zA-Z0-9_-]*$/;
13
14
  const alphanumUnderscoreDollarDash = /^[a-zA-Z0-9_$-]*$/;
14
- const absoluteLinuxPath = /(^\/$|^(\/[a-zA-Z0-9_]+)*$)/; // eslint-disable-next-line no-control-regex
15
-
15
+ const absoluteLinuxPath = /(^\/$|^(\/[a-zA-Z0-9_]+)*$)/;
16
16
  const ascii = /^[\x00-\x7F]+$/;
17
17
  const backupKey = /^[A-Z0-9]{32}$/;
18
+ const basicDomain = /^[a-z0-9-]+(\.[a-z0-9-]{1,63})+$/;
18
19
  const cron = /^[0-9,/*-]+$/;
19
20
  const digits = /^[0-9]*$/;
20
- const macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/; // Used by W3C
21
-
21
+ const macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;
22
22
  const email = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
23
23
  const fourDigitsCode = /^[0-9]{4}$/;
24
24
  const phone = /^\+[0-9]*/;
25
25
  const spaces = /^\s*$/;
26
26
  const sixDigitsCode = /^[0-9]{6}$/;
27
- const url = /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/;
27
+ const url = /^http(s)?:\/\/?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/;
28
28
  const hexadecimal = /^[0-9a-fA-F]+$/;
29
29
 
30
- export { absoluteLinuxPath, alpha, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdots, ascii, backupKey, cron, digits, email, fourDigitsCode, hexadecimal, macAddress, phone, sixDigitsCode, spaces, url };
30
+ export { absoluteLinuxPath, alpha, alphaLower, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdots, ascii, backupKey, basicDomain, cron, digits, email, fourDigitsCode, hexadecimal, macAddress, phone, sixDigitsCode, spaces, url };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  declare const alpha: RegExp;
2
+ declare const alphaLower: RegExp;
2
3
  declare const alphanum: RegExp;
3
4
  declare const alphanumdash: RegExp;
4
5
  declare const alphanumdashdots: RegExp;
@@ -14,6 +15,7 @@ declare const alphanumUnderscoreDollarDash: RegExp;
14
15
  declare const absoluteLinuxPath: RegExp;
15
16
  declare const ascii: RegExp;
16
17
  declare const backupKey: RegExp;
18
+ declare const basicDomain: RegExp;
17
19
  declare const cron: RegExp;
18
20
  declare const digits: RegExp;
19
21
  declare const macAddress: RegExp;
@@ -25,4 +27,4 @@ declare const sixDigitsCode: RegExp;
25
27
  declare const url: RegExp;
26
28
  declare const hexadecimal: RegExp;
27
29
 
28
- export { absoluteLinuxPath, alpha, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdots, ascii, backupKey, cron, digits, email, fourDigitsCode, hexadecimal, macAddress, phone, sixDigitsCode, spaces, url };
30
+ export { absoluteLinuxPath, alpha, alphaLower, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdots, ascii, backupKey, basicDomain, cron, digits, email, fourDigitsCode, hexadecimal, macAddress, phone, sixDigitsCode, spaces, url };
package/dist/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  const alpha = /^[a-zA-Z]*$/;
2
+ const alphaLower = /^[a-z]+$/;
2
3
  const alphanum = /^[a-zA-Z0-9]*$/;
3
4
  const alphanumdash = /^[a-zA-Z0-9-]*$/;
4
5
  const alphanumdashdots = /^[a-zA-Z0-9-.]*$/;
@@ -11,20 +12,19 @@ const alphanumLowercase = /^[a-z0-9]+$/;
11
12
  const alphanumSpacesDotsUnderscoreDash = /^[a-zA-Z0-9-.\s_]*$/;
12
13
  const alphanumUnderscoreDash = /^[a-zA-Z0-9_-]*$/;
13
14
  const alphanumUnderscoreDollarDash = /^[a-zA-Z0-9_$-]*$/;
14
- const absoluteLinuxPath = /(^\/$|^(\/[a-zA-Z0-9_]+)*$)/; // eslint-disable-next-line no-control-regex
15
-
15
+ const absoluteLinuxPath = /(^\/$|^(\/[a-zA-Z0-9_]+)*$)/;
16
16
  const ascii = /^[\x00-\x7F]+$/;
17
17
  const backupKey = /^[A-Z0-9]{32}$/;
18
+ const basicDomain = /^[a-z0-9-]+(\.[a-z0-9-]{1,63})+$/;
18
19
  const cron = /^[0-9,/*-]+$/;
19
20
  const digits = /^[0-9]*$/;
20
- const macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/; // Used by W3C
21
-
21
+ const macAddress = /^([0-9a-fA-F][0-9a-fA-F]:){5}([0-9a-fA-F][0-9a-fA-F])$/;
22
22
  const email = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/;
23
23
  const fourDigitsCode = /^[0-9]{4}$/;
24
24
  const phone = /^\+[0-9]*/;
25
25
  const spaces = /^\s*$/;
26
26
  const sixDigitsCode = /^[0-9]{6}$/;
27
- const url = /^(http:\/\/www\.|https:\/\/www\.|http:\/\/|https:\/\/)?[a-z0-9]+([-.]{1}[a-z0-9]+)*\.[a-z]{2,5}(:[0-9]{1,5})?(\/.*)?$/;
27
+ const url = /^http(s)?:\/\/?[\w.-]+(?:\.[\w.-]+)+[\w\-._~:/?#[\]@!$&'()*+,;=.]+$/;
28
28
  const hexadecimal = /^[0-9a-fA-F]+$/;
29
29
 
30
- export { absoluteLinuxPath, alpha, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdots, ascii, backupKey, cron, digits, email, fourDigitsCode, hexadecimal, macAddress, phone, sixDigitsCode, spaces, url };
30
+ export { absoluteLinuxPath, alpha, alphaLower, alphanum, alphanumLowercase, alphanumSpacesDotsUnderscoreDash, alphanumUnderscoreDash, alphanumUnderscoreDollarDash, alphanumdash, alphanumdashdots, alphanumdashdotsorempty, alphanumdashdotsspaces, alphanumdashorempty, alphanumdashspaces, alphanumdots, ascii, backupKey, basicDomain, cron, digits, email, fourDigitsCode, hexadecimal, macAddress, phone, sixDigitsCode, spaces, url };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scaleway/regex",
3
- "version": "2.1.0",
3
+ "version": "2.2.3",
4
4
  "description": "A small utility to use regex",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -18,5 +18,5 @@
18
18
  "directory": "packages/regex"
19
19
  },
20
20
  "license": "MIT",
21
- "gitHead": "64aa3fdb7907402a1d24de9d884e7fae321b10e5"
21
+ "gitHead": "ff7f6755c6eac35e88d2c8f177fc74c678095800"
22
22
  }