Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Week1-Assignment #1

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

Merged
merged 4 commits into from
Aug 13, 2019
Merged

Week1-Assignment #1

merged 4 commits into from
Aug 13, 2019

Conversation

Radhikajram
Copy link
Owner

No description provided.

Copy link

@grod220 grod220 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job!

function main(url) {
fetchJSON(url, (err, data) => {
const root = document.getElementById('root');
const myParent = document.body;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Who is my? I'd call it something like BodyEl

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed myParent to BodyEl.

createAndAppend('pre', root, { text: JSON.stringify(data, null, 2) });
// Create div element 'select' in document body to hold the label element and list box.

createAndAppend('div', myParent, { id: 'select' });
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The id name is a bit confusing here. Would call is something like select-container or something.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Corrected the container name for select as - selectcontainer.

// section1 - Repository Information.
// section2 - Contributions.

createAndAppend('div', root, { id: 'section1' });
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would name these divs closer to what content they will hold. More like contributors and repo-details

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected the name div name as repodetails,contributorinfomation

// Insert Select div first in the body before root div.
myParent.insertBefore(select, document.getElementById('root'));

loadSelectionValues(JSON.stringify(data, null, 2));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it need to be stringified? Kinda confused what the other two parameters do.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was there in existing code, but i corrected ans used the data as such.

const sortRepoName = [];

const userRepo = JSON.parse(userInfo);
const mySelect = document.getElementById('myselect');
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what the word my helps signify. Think a better name could be used?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

corrected with name selectrepo.

}

// sort the repo name using sort function and localeComapare for uppercase and lowercase sorting.
sortRepoName.sort((a, b) => a.localeCompare(b));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I've never heard of localCompare before

const selectedValue = selectBox.options[selectBox.selectedIndex].value;

// Load Repository information for the choose repository name in the select box.
loadDiv(userRepo, selectedValue);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job creating separate functions. But can we rename this to something more clear on what it does?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed the function name as loadRepoDetails.


`${'<p id="updated">'} Updated : ${formatedUpdate}</p>`,
'</div>',
);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting technique here. Yes, this will work.

if (err) {
createAndAppend('div', root, { text: err.message, class: 'alert-error' });
} else {
addContributors(data);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice making a new function here 👍

@@ -9,7 +9,7 @@
"author": "Jim Cramer",
"license": "CC-BY-4.0",
"devDependencies": {
"eslint": "^5.9.0",
"eslint": "^5.16.0",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Necessary?

Copy link

@grod220 grod220 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to approve the week 1 stuff and request changes for week 2

@Radhikajram Radhikajram merged commit d43ea2b into master Aug 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants