Skip to content
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

single and doubly lists #24

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

single and doubly lists #24

wants to merge 1 commit into from

Conversation

agil
Copy link
Member

@agil agil commented Jul 9, 2018

No description provided.

@agil agil requested a review from tshemsedinov July 9, 2018 18:52
Copy link
Member

@tshemsedinov tshemsedinov left a comment

Choose a reason for hiding this comment

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

LGTM except minor syntax issues. Also we don't use spaces in empty lines and trailing spaces at all.


append(value) {
if (!list.head) {
list.head = Node(value)
Copy link
Member

Choose a reason for hiding this comment

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

semicolon


append(value) {
if (!list.head) {
list.head = Node(value)
Copy link
Member

Choose a reason for hiding this comment

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

semicolon

@@ -0,0 +1,64 @@

Copy link
Member

Choose a reason for hiding this comment

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

'use strict';

@@ -0,0 +1,64 @@

const Node = (value, next = null) => ({
Copy link
Member

Choose a reason for hiding this comment

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

It is not a class or prototype constructor so I'd like to use lowerCamelCase here.

list.append(4);
list.remove(3);

for (item of list) {
Copy link
Member

Choose a reason for hiding this comment

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

for (const item of list) {


// Usage

const list = LinkedList();
Copy link
Member

Choose a reason for hiding this comment

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

lowerCamelCase

next,
});

const LinkedList = () => {
Copy link
Member

Choose a reason for hiding this comment

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

lowerCamelCase

@@ -0,0 +1,66 @@

Copy link
Member

Choose a reason for hiding this comment

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

'use strict';

}
},

[Symbol.iterator]: function* () {
Copy link
Member

Choose a reason for hiding this comment

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

Use shorter syntax for generator as a class/object method:

{
  *[Symbol.iterator]() {
    // code here
  }
}

}
},

[Symbol.iterator]: function* () {
Copy link
Member

Choose a reason for hiding this comment

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

Use shorter syntax for generators.

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