@zeesoft/i18n-verify 2.1.4 → 2.1.7

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.
Files changed (61) hide show
  1. package/dist/genrc.mjs +1 -0
  2. package/dist/i18n.mjs +1 -0
  3. package/dist/index.mjs +1 -0
  4. package/package.json +25 -17
  5. package/postinstall.js +28 -0
  6. package/readme.md +21 -1
  7. package/dist/driver/adapters/cypress.js +0 -161
  8. package/dist/driver/adapters/nightwatch.js +0 -160
  9. package/dist/driver/adapters/selenium.js +0 -90
  10. package/dist/driver/adapters/webdriver.io.js +0 -81
  11. package/dist/driver/baseDriver.js +0 -93
  12. package/dist/driver/factory.js +0 -27
  13. package/dist/index.js +0 -52
  14. package/dist/lib/config.js +0 -102
  15. package/dist/lib/i18n.js +0 -259
  16. package/dist/lib/reports.js +0 -140
  17. package/dist/lib/validator/base.js +0 -125
  18. package/dist/lib/validator/currency.js +0 -94
  19. package/dist/lib/validator/date.js +0 -72
  20. package/dist/lib/validator/datetime.js +0 -72
  21. package/dist/lib/validator/index.js +0 -156
  22. package/dist/lib/validator/number.js +0 -58
  23. package/dist/lib/validator/percentage.js +0 -78
  24. package/dist/lib/validator/string.js +0 -172
  25. package/dist/lib/validator/time.js +0 -72
  26. package/dist/template/report.html +0 -1678
  27. package/dist/utils/cache.js +0 -47
  28. package/dist/utils/common.js +0 -18
  29. package/dist/utils/configFile.js +0 -65
  30. package/dist/utils/constants.js +0 -148
  31. package/dist/utils/cypress.js +0 -120
  32. package/dist/utils/dateUtils/chronoNode.js +0 -52
  33. package/dist/utils/file.js +0 -61
  34. package/dist/utils/graphic.js +0 -57
  35. package/dist/utils/logs.js +0 -79
  36. package/dist/utils/objects/cacheData.js +0 -72
  37. package/dist/utils/objects/metaData.js +0 -29
  38. package/dist/utils/objects/reportData.js +0 -30
  39. package/dist/utils/objects/statData.js +0 -380
  40. package/dist/utils/objects/stringData.js +0 -64
  41. package/dist/utils/objects/stringInfo.js +0 -51
  42. package/dist/utils/regex.js +0 -8
  43. package/dist/utils/reportFactory/base.js +0 -59
  44. package/dist/utils/reportFactory/html/index.js +0 -51
  45. package/dist/utils/reportFactory/html/template/body.js +0 -117
  46. package/dist/utils/reportFactory/html/template/css.js +0 -476
  47. package/dist/utils/reportFactory/html/template/html.js +0 -63
  48. package/dist/utils/reportFactory/html/template/javascript/data.js +0 -66
  49. package/dist/utils/reportFactory/html/template/javascript/global.js +0 -45
  50. package/dist/utils/reportFactory/html/template/javascript/grid.js +0 -129
  51. package/dist/utils/reportFactory/html/template/javascript/index.js +0 -22
  52. package/dist/utils/reportFactory/html/template/javascript/insight.js +0 -248
  53. package/dist/utils/reportFactory/html/template/javascript/log.js +0 -19
  54. package/dist/utils/reportFactory/html/template/javascript/menuBar.js +0 -123
  55. package/dist/utils/reportFactory/html/template/javascript/overview.js +0 -818
  56. package/dist/utils/reportFactory/index.js +0 -36
  57. package/dist/utils/reportFactory/table.js +0 -95
  58. package/dist/utils/resource.js +0 -58
  59. package/dist/utils/runtime.js +0 -36
  60. package/dist/utils/scripts/genreport.js +0 -1
  61. package/dist/utils/scripts/postinstall.js +0 -22
@@ -1,72 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _luxon = require("luxon");
8
- var _base = _interopRequireDefault(require("./base.js"));
9
- var _chronoNode = require("../../utils/dateUtils/chronoNode.js");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- class DateTimeValidator extends _base.default {
12
- constructor() {
13
- super('dateTime');
14
- }
15
-
16
- /**
17
- *
18
- * @override
19
- */
20
- validate(string) {
21
- return this.#isDefaultDateTime(string) || this.isInternationalized(string);
22
- }
23
-
24
- /**
25
- *
26
- * @override
27
- */
28
- isInternationalized(string) {
29
- return this.#isValidDateTime(this.isQaLocale() ? this.defaultLocale() : this.currentLocale(), string);
30
- }
31
-
32
- /**
33
- *
34
- * @override
35
- */
36
- buildConfig() {}
37
- #isValidDateTime(locale, string) {
38
- return this.#verifyUsingGlobalize(locale, string) || this.#verifyUsingLuxon(locale, string) || this.#verifyUsingChrono(locale, string);
39
- }
40
- #isDefaultDateTime(string) {
41
- return this.#isValidDateTime(this.defaultLocale(), string);
42
- }
43
- #verifyUsingGlobalize(locale, string) {
44
- const formats = ['short', 'medium', 'long', 'full'];
45
- for (let format of formats) {
46
- // Try parsing as time
47
- const timeParser = this.getGlobalize(locale).dateParser({
48
- datetime: format
49
- });
50
- if (timeParser(string)) {
51
- return true;
52
- }
53
- }
54
- return false;
55
- }
56
- #verifyUsingLuxon(locale, string) {
57
- const formats = [_luxon.DateTime.DATETIME_SHORT, _luxon.DateTime.DATETIME_SHORT_WITH_SECONDS, _luxon.DateTime.DATETIME_MED, _luxon.DateTime.DATETIME_MED_WITH_SECONDS, _luxon.DateTime.DATETIME_MED_WITH_WEEKDAY, _luxon.DateTime.DATETIME_FULL, _luxon.DateTime.DATETIME_FULL_WITH_SECONDS, _luxon.DateTime.DATETIME_HUGE, _luxon.DateTime.DATETIME_HUGE_WITH_SECONDS];
58
- for (let format of formats) {
59
- const parsed = _luxon.DateTime.fromFormat(string, format, {
60
- locale
61
- });
62
- if (parsed.isValid) {
63
- return true;
64
- }
65
- }
66
- return false;
67
- }
68
- #verifyUsingChrono(locale, string) {
69
- return (0, _chronoNode.isValid)(this.isQaLocale() ? this.defaultLocale() : locale, string);
70
- }
71
- }
72
- exports.default = DateTimeValidator;
@@ -1,156 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _constants = require("../../utils/constants.js");
8
- var _config = _interopRequireDefault(require("../config.js"));
9
- var _currency = _interopRequireDefault(require("./currency.js"));
10
- var _date = _interopRequireDefault(require("./date.js"));
11
- var _datetime = _interopRequireDefault(require("./datetime.js"));
12
- var _number = _interopRequireDefault(require("./number.js"));
13
- var _percentage = _interopRequireDefault(require("./percentage.js"));
14
- var _string = _interopRequireDefault(require("./string.js"));
15
- var _time = _interopRequireDefault(require("./time.js"));
16
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
17
- class Validator {
18
- static #issuesMap = {};
19
- /**
20
- * Collection of methods to validate and determine string issues
21
- * @type {StringValidator}
22
- */
23
- static #string;
24
-
25
- /**
26
- * Collection of methods to validate and determine number issues
27
- * @type {NumberValidator}
28
- */
29
- static #number;
30
-
31
- /**
32
- * Collection of methods to validate and determine date issues
33
- * @type {DateValidator}
34
- */
35
- static #date;
36
-
37
- /**
38
- * Collection of methods to validate and determine date issues
39
- * @type {TimeValidator}
40
- */
41
- static #time;
42
-
43
- /**
44
- * Collection of methods to validate and determine dateTime issues
45
- * @type {DateTimeValidator}
46
- */
47
- static #dateTime;
48
-
49
- /**
50
- * Collection of methods to validate and determine currency issues
51
- * @type {CurrencyValidator}
52
- */
53
- static #currency;
54
-
55
- /**
56
- * Collection of methods to validate and determine percentage issues
57
- * @type {PercentageValidator}
58
- */
59
- static #percentage;
60
- static load() {
61
- Validator.#string = new _string.default();
62
- Validator.#number = new _number.default();
63
- Validator.#date = new _date.default();
64
- Validator.#time = new _time.default();
65
- Validator.#dateTime = new _datetime.default();
66
- Validator.#currency = new _currency.default();
67
- Validator.#percentage = new _percentage.default();
68
- }
69
- /**
70
- *
71
- * @param {String} string
72
- * @returns {Promise<String>} issue type
73
- */
74
- static getIssueType(string) {
75
- const locale = _config.default.getLocale();
76
- if (locale) {
77
- let type = _constants.I18N_STATUS.UNTRANSLATED;
78
- if (!Validator.#issuesMap[locale]) {
79
- Validator.#issuesMap[locale] = {};
80
- }
81
-
82
- // return from cache
83
- if (Validator.#issuesMap[locale][string]) {
84
- return Validator.#issuesMap[locale][string];
85
- }
86
-
87
- // handle DNT, Auto Ignored, Ignored and Encoding cases
88
- if (this.#string.isAutoIgnoredText(string)) {
89
- type = _constants.I18N_STATUS.AUTO_IGNORE;
90
- } else if (this.#string.isDntText(string)) {
91
- type = _constants.I18N_STATUS.DNT;
92
- } else if (this.#string.isIgnoredText(string)) {
93
- type = _constants.I18N_STATUS.IGNORE;
94
- } else if (this.#string.hasEncodingIssue(string)) {
95
- type = _constants.I18N_STATUS.ENCODING_ISSUE;
96
- }
97
- // handle currency cases
98
- else if (this.#currency.validate(string)) {
99
- type = this.#currency.isInternationalized(string) ? _constants.I18N_STATUS.CURRENCY_LOCALIZED : _constants.I18N_STATUS.CURRENCY_NOT_LOCALIZED;
100
- }
101
- // handle percentage cases
102
- else if (this.#percentage.validate(string)) {
103
- type = this.#percentage.isInternationalized(string) ? _constants.I18N_STATUS.PERCENTAGE_LOCALIZED : _constants.I18N_STATUS.PERCENTAGE_NOT_LOCALIZED;
104
- }
105
- //handle number cases
106
- else if (this.#number.validate(string)) {
107
- type = this.#number.isInternationalized(string) ? _constants.I18N_STATUS.NUMBER_LOCALIZED : _constants.I18N_STATUS.NUMBER_NOT_LOCALIZED;
108
- }
109
- // handle date cases
110
- else if (this.#date.validate(string)) {
111
- type = this.#date.isInternationalized(string) ? _constants.I18N_STATUS.DATE_LOCALIZED : _constants.I18N_STATUS.DATE_NOT_LOCALIZED;
112
- }
113
- // handle time cases
114
- else if (this.#time.validate(string)) {
115
- type = this.#time.isInternationalized(string) ? _constants.I18N_STATUS.TIME_LOCALIZED : _constants.I18N_STATUS.TIME_NOT_LOCALIZED;
116
- }
117
- // handle dateTime cases
118
- else if (this.#dateTime.validate(string)) {
119
- type = this.#dateTime.isInternationalized(string) ? _constants.I18N_STATUS.DATE_TIME_LOCALIZED : _constants.I18N_STATUS.DATE_TIME_NOT_LOCALIZED;
120
- }
121
- // handle string cases
122
- else if (this.#string.validate(string)) {
123
- // handle QA strings
124
- if (this.#string.isQaLocale()) {
125
- if (this.#string.isFullQaLanguageText(string)) {
126
- type = _constants.I18N_STATUS.STRING_LOCALIZED;
127
- } else if (this.#string.isPartialQaLanguageText(string)) {
128
- type = _constants.I18N_STATUS.STRING_PARTIALLY_LOCALIZED;
129
- } else {
130
- type = _constants.I18N_STATUS.STRING_NOT_LOCALIZED;
131
- }
132
- }
133
- // handle string i18n cases
134
- else if (!this.#string.isDefaultLocale() && this.#string.isSupportedLocale()) {
135
- if (this.#string.isLocalized(string)) {
136
- type = _constants.I18N_STATUS.STRING_LOCALIZED;
137
- } else if (this.#string.isPartiallyLocalizedText(string)) {
138
- type = _constants.I18N_STATUS.STRING_PARTIALLY_LOCALIZED;
139
- } else if (!this.#string.isInternationalized(string)) {
140
- type = _constants.I18N_STATUS.STRING_NOT_LOCALIZED;
141
- } else {
142
- type = _constants.I18N_STATUS.UNTRANSLATED;
143
- }
144
- }
145
- } else if (this.#string.isDefaultLocale()) {
146
- type = _constants.I18N_STATUS.AUTO_IGNORE;
147
- }
148
-
149
- // add to cache
150
- Validator.#issuesMap[locale][string] = type;
151
- return type;
152
- }
153
- return _constants.I18N_STATUS.UNTRANSLATED;
154
- }
155
- }
156
- exports.default = Validator;
@@ -1,58 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _base = _interopRequireDefault(require("./base.js"));
8
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
9
- class NumberValidator extends _base.default {
10
- constructor() {
11
- super('number');
12
- }
13
-
14
- /**
15
- *
16
- * @override
17
- */
18
- validate(string) {
19
- return this.#isDefaultNumber(string) || this.isInternationalized(string);
20
- }
21
-
22
- /**
23
- *
24
- * @override
25
- */
26
- isInternationalized(string) {
27
- return this.#isValidNumber(this.currentLocale(), string);
28
- }
29
-
30
- /**
31
- *
32
- * @override
33
- */
34
- buildConfig() {}
35
-
36
- /**
37
- * check whether the given value is a valid number of the supplied locale
38
- *
39
- * @param {String} locale
40
- * @param {String} string
41
- * @returns {Boolean}
42
- */
43
- #isValidNumber(locale, string) {
44
- const parser = this.getGlobalize(locale).numberParser();
45
- return !isNaN(parser(string));
46
- }
47
-
48
- /**
49
- * check whether the given value is a valid number of default locale
50
- *
51
- * @param {String} string
52
- * @returns {Boolean}
53
- */
54
- #isDefaultNumber(string) {
55
- return this.#isValidNumber(this.defaultLocale(), string);
56
- }
57
- }
58
- exports.default = NumberValidator;
@@ -1,78 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _regex = require("../../utils/regex.js");
8
- var _base = _interopRequireDefault(require("./base.js"));
9
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
10
- class PercentageValidator extends _base.default {
11
- constructor() {
12
- super('percentage');
13
- }
14
-
15
- /**
16
- *
17
- * @override
18
- */
19
- validate(string) {
20
- return this.#isDefaultPercentage(string) || this.isInternationalized(string);
21
- }
22
-
23
- /**
24
- *
25
- * @override
26
- */
27
- isInternationalized(string) {
28
- return this.#isValidPercentage(this.currentLocale(), string);
29
- }
30
-
31
- /**
32
- *
33
- * @override
34
- */
35
- buildConfig() {}
36
-
37
- /**
38
- * check whether the given value is a valid percentage of the supplied locale
39
- *
40
- * @param {String} locale
41
- * @param {String} string
42
- * @returns {Boolean}
43
- */
44
- #isValidPercentage(locale, string) {
45
- const hasPercentageSymbol = this.#hasPercentage(locale, string);
46
- if (!hasPercentageSymbol) {
47
- return false;
48
- }
49
- const clearNumber = this.#getClearNumber(string);
50
- return !isNaN(this.getGlobalize(locale).numberParser()(clearNumber));
51
- }
52
- #getClearNumber(string = '') {
53
- return string.replace(new RegExp(`(^(?:${(0, _regex.getSpacePattern)()})*|(?:${(0, _regex.getSpacePattern)()})*$)`, 'g'), '').replace(/^-/, '').replace(/٪|%/g, '').trim();
54
- }
55
- #hasPercentage(locale, string) {
56
- const baseNumber = '[0-9,. ]+';
57
- let pattern;
58
-
59
- // in persian and arabic contexts, percentage comes before the number
60
- if (['fa-IR', 'fa-ir'].includes(locale) || locale.startsWith('ar')) {
61
- pattern = new RegExp(`(?:-)?(?:${(0, _regex.getSpacePattern)()})?(?:٪|%)(?:${(0, _regex.getSpacePattern)()})?${baseNumber}`, 'g');
62
- } else {
63
- pattern = new RegExp(`(?:-)?(?:${(0, _regex.getSpacePattern)()})?${baseNumber}(?:${(0, _regex.getSpacePattern)()})?(?:٪|%)`, 'g');
64
- }
65
- return pattern.test(string);
66
- }
67
-
68
- /**
69
- * check whether the given value is a valid percentage of default locale
70
- *
71
- * @param {String} string
72
- * @returns {Boolean}
73
- */
74
- #isDefaultPercentage(string) {
75
- return this.#isValidPercentage(this.defaultLocale(), string);
76
- }
77
- }
78
- exports.default = PercentageValidator;
@@ -1,172 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _constants = require("../../utils/constants.js");
8
- var _config = _interopRequireDefault(require("../config.js"));
9
- var _base = _interopRequireDefault(require("./base.js"));
10
- var _tinyld = require("tinyld");
11
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
12
- /**
13
- * String validation class
14
- */
15
- class StringValidator extends _base.default {
16
- constructor() {
17
- super('string');
18
- }
19
-
20
- /**
21
- *
22
- * @override
23
- */
24
- buildConfig() {
25
- const options = _config.default.getOptions();
26
- this.addToConfig('mockChars', options?.qaMock);
27
- this.addToConfig('resource', _config.default.getResourceBundle(), {});
28
- this.addToConfig('garbledChars', _config.default.getGarbledChars()?.filter(v => String(v).trim()).filter(Boolean), []);
29
- }
30
-
31
- /**
32
- *
33
- * @override
34
- */
35
- isInternationalized(string) {
36
- return this.getConfig()?.resource?.[this.defaultLocale()]?.includes(string);
37
- }
38
-
39
- /**
40
- *
41
- * @override
42
- */
43
- validate(string) {
44
- return typeof string === 'string'; // add more constraints
45
- }
46
-
47
- /**
48
- * to check if the string is a DNT string
49
- *
50
- * @param {String} string
51
- * @returns {Boolean}
52
- */
53
- isDntText(string) {
54
- return this.getConfig()?.resource?.dnt?.includes(string);
55
- }
56
-
57
- /**
58
- * to check if the string can be treated as an auto ingored string
59
- *
60
- * @param {String} string
61
- * @returns {Boolean}
62
- */
63
- isAutoIgnoredText(string) {
64
- return this.isDefaultLocale() || this.isUserInputText(string) || this.isEmailText(string) || this.isUrlText(string);
65
- }
66
-
67
- /**
68
- * to check if the string is an Ignored string
69
- *
70
- * @param {String} string
71
- * @returns {Boolean}
72
- */
73
- isIgnoredText(string) {
74
- return this.getConfig()?.resource?.ignore?.includes(string);
75
- }
76
-
77
- /**
78
- * to check if the string is a user input
79
- *
80
- * @param {String} string
81
- * @returns {Boolean}
82
- */
83
- isUserInputText(string) {
84
- return string.startsWith(_constants.USER_INPUT_PRE_FIX);
85
- }
86
-
87
- /**
88
- * to check if the string is a email string
89
- *
90
- * @param {String} string
91
- * @returns {Boolean}
92
- */
93
- isEmailText(string) {
94
- return _constants.PATTERNS.EMAIL.test(string);
95
- }
96
-
97
- /**
98
- * to check if the string is a Url string
99
- *
100
- * @param {String} string
101
- * @returns {Boolean}
102
- */
103
- isUrlText(string) {
104
- return _constants.PATTERNS.URL.test(string);
105
- }
106
-
107
- /**
108
- * to check if the string is fully localized in QA
109
- *
110
- * @param {String} string
111
- * @returns {Boolean}
112
- */
113
- isFullQaLanguageText(string) {
114
- const config = this.getConfig();
115
- return (string.slice(0, 2) === config?.mockChars?.prefix || string.slice(0, 2) === config?.mockChars?.prefix.toUpperCase()) && string.slice(-2) === config?.mockChars.suffix;
116
- }
117
-
118
- /**
119
- * to check if the string is a DNT string
120
- *
121
- * @param {String} string
122
- * @returns {Boolean}
123
- */
124
- isPartialQaLanguageText(string) {
125
- const config = this.getConfig();
126
- return string.slice(0, 2) === config?.mockChars.prefix || string.slice(0, 2) === config?.mockChars.prefix.toUpperCase() || string.slice(-2) === config?.mockChars.suffix;
127
- }
128
-
129
- /**
130
- * to check if the string has encoding issues
131
- *
132
- * @param {String} string
133
- * @returns {Boolean}
134
- */
135
- hasEncodingIssue(string) {
136
- return this.getConfig()?.garbledChars?.length > 0 && this.getConfig().garbledChars.some(char => string.includes(char));
137
- }
138
-
139
- /**
140
- * to check if the string is a partially localized
141
- *
142
- * @param {String} string
143
- * @returns {Promise<Boolean>}
144
- */
145
- isPartiallyLocalizedText(string) {
146
- return this.#detectLanguageCode(string) === this.currentLanguage();
147
- }
148
-
149
- /**
150
- * detects given string language code
151
- * @param {String} string
152
- */
153
- #detectLanguageCode(string) {
154
- const matches = (0, _tinyld.detectAll)(string);
155
- const currLang = this.currentLanguage();
156
- if (matches.length && matches.find(m => m.lang === currLang)) {
157
- return currLang;
158
- }
159
- return this.defaultLanguage();
160
- }
161
-
162
- /**
163
- * to check if the string is a fully localized
164
- *
165
- * @param {String} string
166
- * @returns {Boolean}
167
- */
168
- isLocalized(string) {
169
- return this.getConfig()?.resource?.[this.currentLocale()]?.includes(string);
170
- }
171
- }
172
- exports.default = StringValidator;
@@ -1,72 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- var _luxon = require("luxon");
8
- var _base = _interopRequireDefault(require("./base.js"));
9
- var _chronoNode = require("../../utils/dateUtils/chronoNode.js");
10
- function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
11
- class TimeValidator extends _base.default {
12
- constructor() {
13
- super('time');
14
- }
15
-
16
- /**
17
- *
18
- * @override
19
- */
20
- validate(string) {
21
- return this.#isDefaultTime(string) || this.isInternationalized(string);
22
- }
23
-
24
- /**
25
- *
26
- * @override
27
- */
28
- isInternationalized(string) {
29
- return this.#isValidTime(this.isQaLocale() ? this.defaultLocale() : this.currentLocale(), string);
30
- }
31
-
32
- /**
33
- *
34
- * @override
35
- */
36
- buildConfig() {}
37
- #isValidTime(locale, string) {
38
- return this.#verifyUsingGlobalize(locale, string) || this.#verifyUsingLuxon(locale, string) || this.#verifyUsingChrono(locale, string);
39
- }
40
- #isDefaultTime(string) {
41
- return this.#isValidTime(this.defaultLocale(), string);
42
- }
43
- #verifyUsingGlobalize(locale, string) {
44
- const formats = ['short', 'medium', 'long', 'full'];
45
- for (let format of formats) {
46
- // Try parsing as time
47
- const timeParser = this.getGlobalize(locale).dateParser({
48
- time: format
49
- });
50
- if (timeParser(string)) {
51
- return true;
52
- }
53
- }
54
- return false;
55
- }
56
- #verifyUsingLuxon(locale, string) {
57
- const formats = [_luxon.DateTime.TIME_SIMPLE, _luxon.DateTime.TIME_WITH_SECONDS, _luxon.DateTime.TIME_WITH_SHORT_OFFSET, _luxon.DateTime.TIME_WITH_LONG_OFFSET, _luxon.DateTime.TIME_24_SIMPLE, _luxon.DateTime.TIME_24_WITH_LONG_OFFSET, _luxon.DateTime.TIME_24_WITH_SECONDS, _luxon.DateTime.TIME_24_WITH_SHORT_OFFSET];
58
- for (let format of formats) {
59
- const parsed = _luxon.DateTime.fromFormat(string, format, {
60
- locale
61
- });
62
- if (parsed.isValid) {
63
- return true;
64
- }
65
- }
66
- return false;
67
- }
68
- #verifyUsingChrono(locale, string) {
69
- return (0, _chronoNode.isValid)(this.isQaLocale() ? this.defaultLocale() : locale, string);
70
- }
71
- }
72
- exports.default = TimeValidator;