path: add depth argument to dirname (recursion)

path.dirname('/foo/bar/baz/asdf/quux')
// returns
'/foo/bar/baz/asdf'

path.dirname('/foo/bar/baz/asdf/quux', 2)
// returns
'/foo/bar/baz'