-
Notifications
You must be signed in to change notification settings - Fork 18
Conversation
|
CLA is valid! |
jlecomte
left a comment
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 would use the es2015 preset in your `.babelrc'. Also, I suggest you use the same eslint config we use for our internal projects, to ensure consistent and strict code styling. I noticed your test files use tabs, but your source files use 4 white spaces for indentation. Please be consistent across the repo (4 white spaces) I will do another review when all these concerns have been addressed. Thanks!
src/code/data-loader.js
Outdated
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.
Shouldn't we throw here?
src/code/data-loader.js
Outdated
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.
Usually, this is done as part of the while statement above...
src/code/data-loader.js
Outdated
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.
Shouldn't we throw here?
src/code/data-loader.js
Outdated
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.
What's Ob? If we throw instead of using console.warn, this is true. Otherwise, it's incorrect since the function can return undefined...
src/code/data-loader.js
Outdated
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.
Missing extra line at the end...
src/code/lookup-utill.js
Outdated
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.
Use const or let on each line...
src/code/lookup-utill.js
Outdated
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.
Use const or let on each line...
src/code/lookup-utill.js
Outdated
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.
Use const or let on each line...
src/code/lookup-utill.js
Outdated
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.
Use const or let on each line...
src/code/lookup-utill.js
Outdated
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.
Remove "Returns" :)
8936944 to
3b7e83e
Compare
|
@jlecomte Addressed them all. |
src/code/data-loader.js
Outdated
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.
parseInt(x, 32) 😮
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 data files contains index and timestamp values as base32 represented strings.
I guess You mean, why base is 32 and not 10 ??
src/code/data-loader.js
Outdated
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.
If you're ever concerned about the performance of this code, this is doing a lot of mutations, where you could just be having a while loop where you increment a counter by 3...
let result = [], i = 0;
while (i < arr.length) {
result.push([arr[i], arr[i + 1], arr[i + 2]);
i += 3;
}And it wouldn't be harder to understand.
|
Overall, I really wish there were more comments everywhere. There's a lot of code that is based on some internal conventions and data structure, so anyone looking at it would have a hard time following it. Some well placed comments would help a lot. |
56773e3 to
be92a49
Compare
|
|
@markandey I skimmed the repo and this PR. Overall, it looks fine to me 👍 but I will let @juandopazo do one final pass. |
|
@juandopazo I did test that static functions are preserved from original Intl.DateTimeFormat. |
5a7baf9 to
d226721
Compare
|
@markandey I took a second look. Overall looks much better! There's still a few issues I noted inline. After those, let's merge this and make it public so we can get some feedback from the community. |
Merge pull request #1 from yahoo/pr
What ?
This Pull Request contains reviewable code from Intl.DateTimeFormat timezone polyfill.
How
Code Files
Polyfill code is split across 3 files.
src/code/polyfill.js
This contains polyfill code. i.e. in this file you would see prototype of Intl.DateTimeFormat and Date is modified to achieve polyfill.
src/code/lookup-utill.js
This file contains functions to get access to timezone data and locale data. To achieve DateTime formatting.
src/code/data-loader.js
This file contains functions unpack data from data file and loads into memory.
Data Files
This data is downloaded from iana
This is transformation of CLDR data.
Compression is achieved by indexing the words in zoneNameIndex array and for every metaZone providing 4 values for shortStandard, shortDayLight, longStandard, longDayLight. separated by
|and every word is separated by,. zoneNameIndex is sorted by words' frequency so that high frequency words represented by small number.e.g.