Skip to content
This repository has been archived by the owner on Nov 3, 2020. It is now read-only.

Delta to MdAST #2

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Delta to MdAST #2

wants to merge 4 commits into from

Conversation

antoineduban
Copy link
Member

No description provided.

@antoineduban antoineduban self-assigned this Dec 15, 2017
Copy link

@Shahor Shahor left a comment

Choose a reason for hiding this comment

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

As a general remark: Can you setup/apply our prettier config in here?

index.js Outdated

function toMdAST() {
this.Parser = function(file) {
const result = fromDelta({})(JSON.parse(file));
Copy link

Choose a reason for hiding this comment

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

You can return directly the call to fromDelta here :)

src/fromDelta.js Outdated
while (currentNode.depth > 0) {
let parentNode = currentNode.parent();
parentNode.children = insertListInChildren(parentNode.children);
currentNode = currentNode.parent();
Copy link

Choose a reason for hiding this comment

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

Can't you use parentNode here?

currentNode = parentNode

src/fromDelta.js Outdated
parentNode.children = insertListInChildren(parentNode.children);
currentNode = currentNode.parent();
}
currentNode.parent().children = insertListInChildren(
Copy link

Choose a reason for hiding this comment

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

Since we don't know what the method parent() does exactly, it would be better to affect its result to a var if we are going to use it more than once, for performance reasons.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants