@@ -22,15 +22,12 @@ const MODULE_NAME = 'ATTRIBUTES_VALIDATOR';
22
22
23
23
/**
24
24
* Validates user's provided attributes
25
- * @param {object } attributes
26
- * @return {boolean } true if the attributes are valid
25
+ * @param {unknown } attributes
26
+ * @return {boolean } true if the attributes are valid
27
27
* @throws If the attributes are not valid
28
28
*/
29
- type Attributes = {
30
- [ key : string ] : string | number | boolean
31
- }
32
29
33
- export function validate ( attributes : Attributes ) : boolean {
30
+ export function validate ( attributes : unknown ) : boolean {
34
31
if ( typeof attributes === 'object' && ! Array . isArray ( attributes ) && attributes !== null ) {
35
32
Object . keys ( attributes ) . forEach ( function ( key ) {
36
33
if ( typeof attributes [ key ] === 'undefined' ) {
@@ -45,11 +42,11 @@ export function validate(attributes: Attributes): boolean {
45
42
46
43
/**
47
44
* Validates user's provided attribute
48
- * @param {string } attributeKey
49
- * @param {string | boolean | number } attributeValue
45
+ * @param {unknown } attributeKey
46
+ * @param {unknown } attributeValue
50
47
* @return {boolean } true if the attribute is valid
51
48
*/
52
- export function isAttributeValid ( attributeKey : string , attributeValue : string | boolean | number ) : boolean {
49
+ export function isAttributeValid ( attributeKey : unknown , attributeValue : unknown ) : boolean {
53
50
return (
54
51
typeof attributeKey === 'string' &&
55
52
( typeof attributeValue === 'string' ||
0 commit comments