Skip to content

Commit cf56a9b

Browse files
committed
Change type attributes, attributeKey, and attributeValue to unknown
1 parent e2db287 commit cf56a9b

File tree

1 file changed

+6
-9
lines changed
  • packages/optimizely-sdk/lib/utils/attributes_validator

1 file changed

+6
-9
lines changed

packages/optimizely-sdk/lib/utils/attributes_validator/index.ts

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,12 @@ const MODULE_NAME = 'ATTRIBUTES_VALIDATOR';
2222

2323
/**
2424
* 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
2727
* @throws If the attributes are not valid
2828
*/
29-
type Attributes = {
30-
[key: string]: string | number | boolean
31-
}
3229

33-
export function validate(attributes: Attributes): boolean {
30+
export function validate(attributes: unknown): boolean {
3431
if (typeof attributes === 'object' && !Array.isArray(attributes) && attributes !== null) {
3532
Object.keys(attributes).forEach(function(key) {
3633
if (typeof attributes[key] === 'undefined') {
@@ -45,11 +42,11 @@ export function validate(attributes: Attributes): boolean {
4542

4643
/**
4744
* Validates user's provided attribute
48-
* @param {string} attributeKey
49-
* @param {string | boolean | number} attributeValue
45+
* @param {unknown} attributeKey
46+
* @param {unknown} attributeValue
5047
* @return {boolean} true if the attribute is valid
5148
*/
52-
export function isAttributeValid(attributeKey: string, attributeValue: string | boolean | number): boolean {
49+
export function isAttributeValid(attributeKey: unknown, attributeValue: unknown): boolean {
5350
return (
5451
typeof attributeKey === 'string' &&
5552
(typeof attributeValue === 'string' ||

0 commit comments

Comments
 (0)