@firedesktop/react-base 1.73.0 → 1.75.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/dist/utils/RegExValidation.d.ts +4 -0
- package/dist/utils/RegExValidation.js +20 -0
- package/dist/utils/RegExValidation.js.map +1 -0
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/index.js.map +1 -1
- package/package.json +1 -1
- package/src/lib/utils/RegExValidation.ts +49 -0
- package/src/lib/utils/index.ts +2 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export default function RegExValidation() {
|
|
2
|
+
var isAValid_CSharpName = function (value) {
|
|
3
|
+
var regex = /^(?![0-9])\w+$/;
|
|
4
|
+
if (!value)
|
|
5
|
+
return false;
|
|
6
|
+
return regex.test(value);
|
|
7
|
+
};
|
|
8
|
+
var isAValid_EmailAddress = function (value) {
|
|
9
|
+
var regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
10
|
+
if (!value)
|
|
11
|
+
return false;
|
|
12
|
+
return regex.test(value);
|
|
13
|
+
};
|
|
14
|
+
return {
|
|
15
|
+
isAValid_CSharpName: isAValid_CSharpName,
|
|
16
|
+
isAValid_EmailAddress: isAValid_EmailAddress
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
;
|
|
20
|
+
//# sourceMappingURL=RegExValidation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RegExValidation.js","sourceRoot":"","sources":["../../src/lib/utils/RegExValidation.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,UAAU,eAAe;IAUnC,IAAM,mBAAmB,GAAG,UAAC,KAAc;QAOvC,IAAM,KAAK,GAAG,gBAAgB,CAAC;QAE/B,IAAI,CAAC,KAAK;YACN,OAAO,KAAK,CAAC;QAEjB,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF,IAAM,qBAAqB,GAAG,UAAC,KAAc;QAWzC,IAAM,KAAK,GAAG,kDAAkD,CAAC;QAEjE,IAAI,CAAC,KAAK;YACN,OAAO,KAAK,CAAC;QAEjB,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7B,CAAC,CAAC;IAEF,OAAO;QACH,mBAAmB,qBAAA;QACnB,qBAAqB,uBAAA;KACxB,CAAC;AACN,CAAC;AAAA,CAAC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import * as Configuration from './configuration';
|
|
|
3
3
|
import CurrencyUtiles from './CurrencyUtiles';
|
|
4
4
|
import DateUtils from './DateUtils';
|
|
5
5
|
import FileUtils from './FileUtils';
|
|
6
|
+
import RegExValidation from './RegExValidation';
|
|
6
7
|
import UrlUtils from './UrlUtils';
|
|
7
8
|
import * as Labels from './labels';
|
|
8
|
-
export { Configuration, CurrencyUtiles, DateUtils, Fetch, FileUtils, Labels, UrlUtils };
|
|
9
|
+
export { Configuration, CurrencyUtiles, DateUtils, Fetch, FileUtils, Labels, RegExValidation, UrlUtils };
|
package/dist/utils/index.js
CHANGED
|
@@ -3,7 +3,8 @@ import * as Configuration from './configuration';
|
|
|
3
3
|
import CurrencyUtiles from './CurrencyUtiles';
|
|
4
4
|
import DateUtils from './DateUtils';
|
|
5
5
|
import FileUtils from './FileUtils';
|
|
6
|
+
import RegExValidation from './RegExValidation';
|
|
6
7
|
import UrlUtils from './UrlUtils';
|
|
7
8
|
import * as Labels from './labels';
|
|
8
|
-
export { Configuration, CurrencyUtiles, DateUtils, Fetch, FileUtils, Labels, UrlUtils };
|
|
9
|
+
export { Configuration, CurrencyUtiles, DateUtils, Fetch, FileUtils, Labels, RegExValidation, UrlUtils };
|
|
9
10
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/lib/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,SAAS,CAAC;AACjC,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,cAAc,MAAM,kBAAkB,CAAC;AAC9C,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,SAAS,MAAM,aAAa,CAAC;AACpC,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,QAAQ,MAAM,YAAY,CAAC;AAElC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AAEnC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,QAAQ,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export default function RegExValidation() {
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* True if
|
|
5
|
+
* - start with a letter
|
|
6
|
+
* - Only contains letters number and _
|
|
7
|
+
*
|
|
8
|
+
* @param value a gnetic string
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
const isAValid_CSharpName = (value?: string): boolean => {
|
|
12
|
+
/**
|
|
13
|
+
* ^ --> asserts the start of the string.
|
|
14
|
+
* (?![0-9]) --> is a negative lookahead that ensures the class name does not start with a digit.
|
|
15
|
+
* \w+ --> matches one or more word characters (alphanumeric characters and underscores).
|
|
16
|
+
* $ --> asserts the end of the string.
|
|
17
|
+
*/
|
|
18
|
+
const regex = /^(?![0-9])\w+$/;
|
|
19
|
+
|
|
20
|
+
if (!value)
|
|
21
|
+
return false;
|
|
22
|
+
|
|
23
|
+
return regex.test(value);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const isAValid_EmailAddress = (value?: string): boolean => {
|
|
27
|
+
/**
|
|
28
|
+
* - ^: Start of the string.
|
|
29
|
+
* - [a-zA-Z0-9._%+-]+: Matches one or more of the characters in the set:
|
|
30
|
+
* letters (both uppercase and lowercase), digits, period (.), underscore (_), percent (%), plus (+), and hyphen (-).
|
|
31
|
+
* - @: Matches the @ symbol.
|
|
32
|
+
* - [a-zA-Z0-9.-]+: Matches one or more letters (both uppercase and lowercase), digits, period (.), or hyphen (-).
|
|
33
|
+
* - \.: Matches a literal period (dot). The backslash \ is used to escape the special meaning of the period.
|
|
34
|
+
* - [a-zA-Z]{2,}: Matches two or more letters (both uppercase and lowercase). This is the top-level domain (TLD) part of the email address.
|
|
35
|
+
* - $: End of the string.
|
|
36
|
+
*/
|
|
37
|
+
const regex = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
38
|
+
|
|
39
|
+
if (!value)
|
|
40
|
+
return false;
|
|
41
|
+
|
|
42
|
+
return regex.test(value);
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
return {
|
|
46
|
+
isAValid_CSharpName,
|
|
47
|
+
isAValid_EmailAddress
|
|
48
|
+
};
|
|
49
|
+
};
|
package/src/lib/utils/index.ts
CHANGED
|
@@ -3,8 +3,9 @@ import * as Configuration from './configuration';
|
|
|
3
3
|
import CurrencyUtiles from './CurrencyUtiles';
|
|
4
4
|
import DateUtils from './DateUtils';
|
|
5
5
|
import FileUtils from './FileUtils';
|
|
6
|
+
import RegExValidation from './RegExValidation';
|
|
6
7
|
import UrlUtils from './UrlUtils';
|
|
7
8
|
|
|
8
9
|
import * as Labels from './labels';
|
|
9
10
|
|
|
10
|
-
export { Configuration, CurrencyUtiles, DateUtils, Fetch, FileUtils, Labels, UrlUtils };
|
|
11
|
+
export { Configuration, CurrencyUtiles, DateUtils, Fetch, FileUtils, Labels, RegExValidation, UrlUtils };
|