8000 refactor: Removed dependency on lodash.values (#396) · github/optimizely-javascript-sdk@c08435e · GitHub
[go: up one dir, main page]

Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit c08435e

Browse files
authored
refactor: Removed dependency on lodash.values (optimizely#396)
Summary: Replaced lodash values function with objectValues from js-sdk-utils. This is part of an effort to remove lodash dependency to reduce bundle size. Test Plan: All Unit tests and Full Stack SDK compatibility passed
1 parent 31b5a4d commit c08435e

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

packages/optimizely-sdk/lib/core/notification_center/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
var enums = require('../../utils/enums');
1818
var fns = require('../../utils/fns');
19-
var sprintf = require('@optimizely/js-sdk-utils').sprintf;
19+
var jsSdkUtils = require('@optimizely/js-sdk-utils');
2020

2121
var LOG_LEVEL = enums.LOG_LEVEL;
2222
var LOG_MESSAGES = enums.LOG_MESSAGES;
@@ -55,7 +55,7 @@ function NotificationCenter(options) {
5555
*/
5656
NotificationCenter.prototype.addNotificationListener = function (notificationType, callback) {
5757
try {
58-
var isNotificationTypeValid = fns.values(enums.NOTIFICATION_TYPES)
58+
var isNotificationTypeValid = jsSdkUtils.objectValues(enums.NOTIFICATION_TYPES)
5959
.indexOf(notificationType) > -1;
6060
if (!isNotificationTypeValid) {
6161
return -1;
@@ -165,7 +165,7 @@ NotificationCenter.prototype.sendNotifications = function (notificationType, not
165165
try {
166166
callback(notificationData);
167167
} catch (ex) {
168-
this.logger.log(LOG_LEVEL.ERROR, sprintf(LOG_MESSAGES.NOTIFICATION_LISTENER_EXCEPTION, MODULE_NAME, notificationType, ex.message));
168+
this.logger.log(LOG_LEVEL.ERROR, jsSdkUtils.sprintf(LOG_MESSAGES.NOTIFICATION_LISTENER_EXCEPTION, MODULE_NAME, notificationType, ex.message));
169169
}
170170
}.bind(this));
171171
} catch (e) {

packages/optimizely-sdk/lib/utils/fns/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ module.exports = {
3333
uuid: function() {
3434
return uuid.v4();
3535
},
36-
values: require('lodash/values'),
3736
isNumber: function(value) {
3837
return typeof value === 'number';
3938
},

0 commit comments

Comments
 (0)
0