-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: update setLibrary api make it ignore the null value of name or version #449
Conversation
src/amplitude-client.js
Outdated
) { | ||
this.options.library = { name: name, version: version }; | ||
AmplitudeClient.prototype.setLibrary = function setLibrary(name, version) { | ||
if (name) this.options.library.name = name; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe wrap other than put them in the same line
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but 2 changes I believe would be good to address
src/amplitude-client.js
Outdated
this.options.library = { name: name, version: version }; | ||
AmplitudeClient.prototype.setLibrary = function setLibrary(name, version) { | ||
if (name) this.options.library.name = name; | ||
if (version) this.options.library.version = version; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should do an explicit check for null
or undefined
. Edge case conditions for falsey values may lead to unexpected outcomes (ike 0
or ''
)
@@ -1114,7 +1114,7 @@ var _convertProxyObjectToRealObject = function _convertProxyObjectToRealObject(i | |||
* var identify = new amplitude.Identify().set('colors', ['rose', 'gold']).add('karma', 1).setOnce('sign_up_date', '2016-03-31'); | |||
* amplitude.identify(identify); | |||
*/ | |||
AmplitudeClient.prototype.identify = function (identify_obj, opt_callback, opt_error_callback) { | |||
AmplitudeClient.prototype.identify = function (identify_obj, opt_callback, opt_error_callback, outOfSession) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be good to add unit test for out of session funcitonality
Summary
Checklist