-
Notifications
You must be signed in to change notification settings - Fork 3
Delta to MdAST #2
base: master
Are you sure you want to change the base?
Conversation
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.
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)); |
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.
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(); |
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.
Can't you use parentNode
here?
currentNode = parentNode
src/fromDelta.js
Outdated
parentNode.children = insertListInChildren(parentNode.children); | ||
currentNode = currentNode.parent(); | ||
} | ||
currentNode.parent().children = insertListInChildren( |
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.
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.
88bc63c
to
0fedb0a
Compare
No description provided.