You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* @description Defines the affix sanitized by specified filter.
13
+
* @description Defines the affix sanitized by specified pattern.
14
14
* @public
15
15
* @static
16
16
* @template {string} [Value=string]
17
-
* @param {Value} value A value of generic type variable `Value` constrained by the `string` type to be sanitized with the `filter`.
18
-
* @param {RegExp} [filter=Affix.filter] The filter of `RegExp` to sanitize the `affix`. Defaults to static `Affix.filter`.
19
-
* @returns {Value} The returned value is an affix of a generic type variable `Value`, optionally sanitized by the `filter`.
17
+
* @param {Value} value A value of generic type variable `Value` constrained by the `string` type to be sanitized with the `pattern`.
18
+
* @param {RegExp} [pattern=Affix.pattern] The pattern of `RegExp` to sanitize the `affix`. Defaults to static `Affix.pattern`.
19
+
* @returns {Value} The returned value is an affix of a generic type variable `Value`, optionally sanitized by the `pattern`.
20
20
*/
21
21
publicstaticsanitize<Valueextendsstring=string>(
22
22
value: Value,
23
-
filter: RegExp=Affix.filter,
23
+
pattern: RegExp=Affix.pattern,
24
24
): Value{
25
-
returnvalue.replace(filter,'')asValue;
25
+
returnvalue.replace(pattern,'')asValue;
26
26
}
27
27
28
28
/**
29
-
* @description The default filter pattern used to sanitize the affix, which removes characters that are not part of the valid characters for the affix.
29
+
* @description The default pattern pattern used to sanitize the affix, which removes characters that are not part of the valid characters for the affix.
30
30
* @public
31
31
* @static
32
32
* @type {RegExp}
33
33
*/
34
-
publicstaticfilter: RegExp=/[^a-zA-Z0-9$_]/g;
34
+
publicstaticpattern: RegExp=/[^a-zA-Z0-9$_]/g;
35
35
36
36
/**
37
-
* @description Returns the privately stored filter of `RegExp` type to sanitize the affix.
37
+
* @description Returns the privately stored pattern of `RegExp` type to sanitize the affix.
38
38
* @public
39
39
* @readonly
40
40
* @type {RegExp}
41
41
*/
42
-
publicgetfilter(): RegExp{
43
-
returnthis.#filter;
42
+
publicgetpattern(){
43
+
returnthis.#pattern;
44
44
}
45
45
46
46
/**
47
-
* @description Privately stored filter of `RegExp` to sanitize the affix.
47
+
* @description Privately stored pattern of `RegExp` to sanitize the affix.
48
48
* @type {RegExp}
49
49
*/
50
-
#filter=Affix.filter;
50
+
#pattern=Affix.pattern;
51
51
52
52
/**
53
53
* Creates an instance of child class.
54
54
* @constructor
55
55
* @param {?Value} [value] An optional initial affix of generic type variable `Value` constrained by `string` type.
56
-
* @param {?RegExp} [filter] The filter of `RegExp` to sanitize the affix.
56
+
* @param {?RegExp} [pattern] The pattern of `RegExp` to sanitize the affix.
57
57
*/
58
-
constructor(value?: Value,filter?: RegExp){
58
+
constructor(value?: Value,pattern?: RegExp){
59
59
super(value||''asValue);
60
-
filterinstanceofRegExp&&(this.#filter=filter);
60
+
patterninstanceofRegExp&&(this.#pattern=pattern);
61
61
typeofvalue!=='undefined'&&this.set(value);
62
62
}
63
63
64
64
/**
65
-
* @description Returns the affix, optionally sanitized by the `filter`.
65
+
* @description Returns the affix, optionally sanitized by the `pattern`.
66
66
* @public
67
-
* @param {?RegExp} [filter] The filter of `RegExp` to sanitize privately stored affix.
68
-
* @returns {string} Returns privately stored `#affix` of `string` type optionally sanitized by the `filter`.
67
+
* @param {?RegExp} [pattern] The pattern of `RegExp` to sanitize privately stored affix.
68
+
* @returns {string} Returns privately stored `#affix` of `string` type optionally sanitized by the `pattern`.
69
69
*/
70
-
publicget(filter?: RegExp){
71
-
returnAffix.sanitize(this.value,filter);
70
+
publicget(pattern?: RegExp){
71
+
returnAffix.sanitize(this.value,pattern);
72
72
}
73
73
74
74
/**
75
75
* @description Sets and stores privately sanitized affix of generic type variable `Value` constrained by `string` type.
76
76
* @private
77
77
* @param {Value} value The `affix` of generic type variable `Value`.
78
-
* @param {RegExp} [filter=this.#filter] The filter of `RegExp` to sanitize the `affix`. Defaults to privately stored `#filter`.
78
+
* @param {RegExp} [pattern=this.#pattern] The pattern of `RegExp` to sanitize the `affix`. Defaults to privately stored `#pattern`.
79
79
* @returns {this} The returned value is current instance for method chaining.
80
80
*/
81
-
publicset(value: Value,filter: RegExp=this.#filter): this {
0 commit comments