-
Notifications
You must be signed in to change notification settings - Fork 213
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
Fix3.0/issue 324 #326
Fix3.0/issue 324 #326
Conversation
…mpressionURLTemplates dailymotion#324
companionClickTrackingURLTemplates, iconClickTrackingURLTemplates, nonlinearClickTrackingURLTemplates, videoClickThroughURLTemplate, videoClickTrackingURLTemplates, videoCustomClickURLTemplates
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.
Pretty great! Many thanks for the contribution, I just have a few comments. Also be sure to update documentation .md files that are affected by these changes :)
Updated to use map, instead of forEach Added function to check for equality of objects using lodash.isequal Added function to create an array of only unique objects when two arrays are merged
package.json
Outdated
@@ -53,6 +53,7 @@ | |||
"sinon": "^2.3.6" | |||
}, | |||
"dependencies": { | |||
"lodash.isequal": "^4.5.0", |
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.
Do we really need to add this dependency ? we try to keep vast-client with fewer decencies as possible. And when I checked the code we don't need to have lodash.isequal
which do deeper check inside an object. What changed here is just instead of having a url now we have plain object with id
and url
.
IMO we should write isTrackingObjectEqual
which is really simple like this:
"lodash.isequal": "^4.5.0", | |
function isTrackingObjectEqual(obj1, obj2) { | |
return obj1.id === obj2.id && obj1.url === obj2.url; | |
} |
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.
yes I also agree, lodash.isequal is rather heavy. It is best to do our own custom function for our needs
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.
Removed the dependency and added a custom method for checking equality
package.json
Outdated
@@ -53,6 +53,7 @@ | |||
"sinon": "^2.3.6" | |||
}, | |||
"dependencies": { | |||
"lodash.isequal": "^4.5.0", |
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.
yes I also agree, lodash.isequal is rather heavy. It is best to do our own custom function for our needs
Got rid of lodash.isequal, replaced it with a custom equal check Moved extractURLsFromTemplates from the tracker to the util class
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.
Almost done! Please also remove the package-lock.json changes :)
src/util/util.js
Outdated
* @param {Object} obj - The object who existence is to be checked. | ||
* @param {Array} list - List of objects. | ||
*/ | ||
function containsObject(obj, list) { |
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.
sorry just another thing to add, the names of these functions shouldn't be so generic because in fact this function is only usable for url templates. same for joinArrayOfUniqueObjs
.
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.
Updated to reflect functionality
Removed lodash from package-lock.json
|
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! 👍
Description
Changes to add the id attribute to:
Issue
#324
Type