Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Please explain what "pathObject" is #36582

Closed
lborgman opened this issue Dec 19, 2020 · 6 comments
Closed

doc: Please explain what "pathObject" is #36582

lborgman opened this issue Dec 19, 2020 · 6 comments
Labels
doc Issues and PRs related to the documentations. question Issues that look for answers.

Comments

@lborgman
Copy link

馃摋 API Reference Docs Problem

Location

https://nodejs.org/api/path.html#path_path_format_pathobject

Description

I can't see any reference to what "pathObject" is (or how to create it).

@lborgman lborgman added the doc Issues and PRs related to the documentations. label Dec 19, 2020
@lborgman
Copy link
Author

Or, hm, I expected a class object, but it seems to be just a {} style object. Please make it more clear.

@aduh95
Copy link
Contributor

aduh95 commented Dec 19, 2020

path.format expects an object that have the properties listed in the docs.Nearly all objects in JavaScript are instances of Object, so it doesn't matter how you create it. Here's a few way of doing it:

  • using the {} notation,
  • creating a custom class
  • using the result of path.parse

How could we make it clearer? Do you have any suggestions?

@lborgman
Copy link
Author

lborgman commented Dec 19, 2020

@aduh95
Just link to a description like the one you wrote here.

BTW, I see this under "pathObject": "Returns: <string>". That looks wrong.

@aduh95
Copy link
Contributor

aduh95 commented Dec 19, 2020

BTW, I see this under "pathObject": "Returns: ". That looks wrong.

I don't think that's wrong, the function does return a string..

$ node -p "path.format({dir: '/home/user/dir', base: 'file.txt'})"
/home/user/dir/file.txt

Do you see something else?

@lborgman
Copy link
Author

@aduh95 Eh, sorry. You are right.

@lborgman
Copy link
Author

lborgman commented Dec 19, 2020

Maybe "any JavaScript object which has the following keys:".

@PoojaDurgad PoojaDurgad added the question Issues that look for answers. label Dec 23, 2020
jasnell added a commit to jasnell/node that referenced this issue Apr 27, 2021
Signed-off-by: James M Snell <jasnell@gmail.com>
Fixes: nodejs#36582
targos pushed a commit that referenced this issue Apr 29, 2021
Signed-off-by: James M Snell <jasnell@gmail.com>
Fixes: #36582

PR-URL: #38437
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
targos pushed a commit that referenced this issue May 30, 2021
Signed-off-by: James M Snell <jasnell@gmail.com>
Fixes: #36582

PR-URL: #38437
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
targos pushed a commit that referenced this issue Jun 5, 2021
Signed-off-by: James M Snell <jasnell@gmail.com>
Fixes: #36582

PR-URL: #38437
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
targos pushed a commit that referenced this issue Jun 5, 2021
Signed-off-by: James M Snell <jasnell@gmail.com>
Fixes: #36582

PR-URL: #38437
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
targos pushed a commit that referenced this issue Jun 11, 2021
Signed-off-by: James M Snell <jasnell@gmail.com>
Fixes: #36582

PR-URL: #38437
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc Issues and PRs related to the documentations. question Issues that look for answers.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants