denoland / denoland/std

(path/parse) suggestion: ParsedPath.toString return string representing full path

Open
#2,498 8 comments 2 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
3.6k
Forks
681
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**

It would be nice if [ParsedPath.toString](https://deno.land/std@0.151.0/path/mod.ts?s=ParsedPath) returned a string of the path that created it, like [URL](https://developer.mozilla.org/en-US/docs/Web/API/URL/toString). Currently it returns `"[object Object]"`.
Example:
```
> const p = parse("/usr/local/bin")
> p.toString()
"/usr/local/bin"
```

**Describe alternatives you've considered**
Adding a property to ParsedPath that represents the full path, like URL.href.

Or just leave it as is. You can achieve the same thing with `parsed.dir + "/" + parsed.base`, `join(parsed.dir, parsed.base)`, or just saving the string you pass into `parse`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.