Skip to content
This repository has been archived by the owner on Jan 6, 2025. It is now read-only.

Commit

Permalink
chore(node.js): get parent only once
Browse files Browse the repository at this point in the history
  • Loading branch information
stfsy committed Mar 28, 2017
1 parent fd07b76 commit 6b2f9c5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ class Node {
* @returns {Node}
*/
get parent() {
const hasParent = this.get().parent
const parent = this.get().parent

if (!hasParent) {
if (!parent) {
return null
}

return new Node(this.get().parent)
return new Node(parent)
}

/**
Expand Down

0 comments on commit 6b2f9c5

Please sign in to comment.