Commit 297c9935 authored by Ryan LeFevre's avatar Ryan LeFevre

Merge pull request #55 from arcanis/patch-1

Fix the root() function
parents 86b97f70 dc2ec02a
...@@ -2,7 +2,7 @@ _ = require 'lodash' ...@@ -2,7 +2,7 @@ _ = require 'lodash'
module.exports = module.exports =
root: -> root: ->
return @ if isRoot() return @ if @isRoot()
return @parent.root() return @parent.root()
isRoot: -> @depth() is 0 isRoot: -> @depth() is 0
...@@ -41,4 +41,4 @@ module.exports = ...@@ -41,4 +41,4 @@ module.exports =
path: (asArray = false) -> path: (asArray = false) ->
path = @ancestors().map((n) -> n.name).concat([@name]) path = @ancestors().map((n) -> n.name).concat([@name])
if asArray then path else path.join('/') if asArray then path else path.join('/')
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment