File tree Expand file tree Collapse file tree 2 files changed +7
-10
lines changed
packages/optimizely-sdk/lib
utils/user_profile_service_validator Expand file tree Collapse file tree 2 files changed +7
-10
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ import { buildConversionEvent, buildImpressionEvent } from '../core/event_builde
25
25
import eventTagsValidator from '../utils/event_tags_validator' ;
26
26
import notificationCenter from '../core/notification_center' ;
27
27
import projectConfig from '../core/project_config' ;
28
- import userProfileServiceValidator from '../utils/user_profile_service_validator' ;
28
+ import * as userProfileServiceValidator from '../utils/user_profile_service_validator' ;
29
29
import * as stringValidator from '../utils/string_value_validator' ;
30
30
import projectConfigManager from '../core/project_config/project_config_manager' ;
31
31
Original file line number Diff line number Diff line change 21
21
import { sprintf } from '@optimizely/js-sdk-utils' ;
22
22
23
23
import { ERROR_MESSAGES } from '../enums' ;
24
- var MODULE_NAME = 'USER_PROFILE_SERVICE_VALIDATOR' ;
24
+
25
+ const MODULE_NAME = 'USER_PROFILE_SERVICE_VALIDATOR' ;
25
26
26
27
/**
27
28
* Validates user's provided user profile service instance
28
- * @param {Object } userProfileServiceInstance
29
- * @return {boolean } True if the instance is valid
29
+ * @param {object } userProfileServiceInstance
30
+ * @return {boolean } true if the instance is valid
30
31
* @throws If the instance is not valid
31
32
*/
32
- export var validate = function ( userProfileServiceInstance ) {
33
+ export function validate ( userProfileServiceInstance : Record < string , unknown > ) : boolean {
33
34
if ( typeof userProfileServiceInstance . lookup !== 'function' ) {
34
35
throw new Error ( sprintf ( ERROR_MESSAGES . INVALID_USER_PROFILE_SERVICE , MODULE_NAME , "Missing function 'lookup'" ) ) ;
35
36
} else if ( typeof userProfileServiceInstance . save !== 'function' ) {
36
37
throw new Error ( sprintf ( ERROR_MESSAGES . INVALID_USER_PROFILE_SERVICE , MODULE_NAME , "Missing function 'save'" ) ) ;
37
38
}
38
39
return true ;
39
- } ;
40
-
41
- export default {
42
- validate : validate ,
43
- } ;
40
+ }
You can’t perform that action at this time.
0 commit comments