Skip to content

doc: path.format provide more examples - #5838

Closed
eversojk wants to merge 1 commit into
nodejs:masterfrom
eversojk:doc-path-format-more-examples
Closed

doc: path.format provide more examples#5838
eversojk wants to merge 1 commit into
nodejs:masterfrom
eversojk:doc-path-format-more-examples

Conversation

@eversojk

Copy link
Copy Markdown
Contributor

Pull Request check-list

  • Does make -j8 test (UNIX) or vcbuild test nosign (Windows) pass with
    this change (including linting)?
  • Is the commit message formatted according to [CONTRIBUTING.md][0]?
  • If this change fixes a bug (or a performance problem), is a regression
    test (or a benchmark) included?
  • Is a documentation update included (if this change modifies
    existing APIs, or introduces new ones)?

Affected core subsystem(s)

path

Description of change

Added examples for all cases of path.format for V5.9.0 on Linux.

Fixes#5747

@eversojk

Copy link
Copy Markdown
ContributorAuthor

I've run the tests to get into the habit of doing so and seem to be getting an error unrelated to any of my changes. If someone could confirm they are seeing something similar I'd be happy to create an issue.

makejslintmake[1]: Enteringdirectory'/home/john/projects/node'./nodetools/eslint/bin/eslint.jsbenchmarklibsrctesttools/doc \
tools/eslint-rules--rulesdirtools/eslint-rules/home/john/projects/node/benchmark/http_simple_auto.js16:13errorStringsmustusesinglequotequotes35:19errorStringsmustusesinglequotequotes44:12error'i'isnotdefinedno-undef44:19error'i'isnotdefinedno-undef44:26error'i'isnotdefinedno-undef45:25error'i'isnotdefinedno-undef77:10error'i'isnotdefinedno-undef77:37error'i'isnotdefinedno-undef77:46error'i'isnotdefinedno-undef78:28error'i'isnotdefinedno-undef78:38error'i'isnotdefinedno-undef11problems(11errors,0warnings)
Makefile:596: recipefortarget'jslint'failedmake[1]: ***[jslint]Error1make[1]: Leavingdirectory'/home/john/projects/node'
Makefile:115: recipefortarget'test'failedmake: ***[test]Error2

@eversojk

Copy link
Copy Markdown
ContributorAuthor

Ready for review

@Trott

Copy link
Copy Markdown
Member

Regarding the benchmark tests failing lint, not your problem, it's #5359. I'll put together a fix now unless someone beats me to it.

@Trott

Copy link
Copy Markdown
Member

The fix has landed, so if you do a rebase against master, it should clear up the linting issue you had.

@Trott

Copy link
Copy Markdown
Member

OK, so looking at the change you made here, it's all correct, but I think it would be better to format the changes as if the pathObject were the output of path.parse() (just mangled appropriately by removing properties as needed for each example).

So, for example, the value of root will always be / and the value of dir will never have a trailing slash.

> path.parse('/home/user/dir/file.txt')
{ root: '/',
dir: '/home/user/dir',
base: 'file.txt',
ext: '.txt',
name: 'file' }
> 

So maybe start with that output above and just delete properties as needed (and update your results, of course, as needed)?

Is that clear? I hope I'm making sense...

@jasnelljasnell added the doc Issues and PRs related to the documentations. label Mar 22, 2016
@mscdexmscdex added the path Issues and PRs related to the path subsystem. label Mar 22, 2016
@eversojk

Copy link
Copy Markdown
ContributorAuthor

Makes perfect sense, I'll add in those changes.

@eversojk
eversojkforce-pushed the doc-path-format-more-examples branch from d2e55ae to 42eabf7CompareMarch 23, 2016 01:29
@eversojk

Copy link
Copy Markdown
ContributorAuthor

I've updated with your suggestions. I used /home/user/dir/file.txt for all examples except to trigger the scenario where dir === root which I used /file.txt.

Would it be preferred that I squash all of my commits and explain what my change is in the squashed commit before having you review?

@eversojk
eversojkforce-pushed the doc-path-format-more-examples branch from 5d4bfaf to a612f3dCompareMarch 23, 2016 02:36
@Trott

Copy link
Copy Markdown
Member

Now is probably a good time to squash, yes.

Comment threaddoc/api/path.markdown Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Would it help to put a period at the end of this line and the one above to make it clear that the subsequent line is a new sentence?

@Trott

Copy link
Copy Markdown
Member

LGTM with nits that can be ignored if you disagree with them.

@eversojk

Copy link
Copy Markdown
ContributorAuthor

I agree with the nits, I debated doing that.

@eversojk
eversojkforce-pushed the doc-path-format-more-examples branch from ba60503 to 4b0d410CompareMarch 23, 2016 03:14
@eversojk

Copy link
Copy Markdown
ContributorAuthor

Nits updated and commits squashed.

@Trott

Copy link
Copy Markdown
Member

/cc @nodejs/documentation

@jasnell

Copy link
Copy Markdown
Member

LGTM

@Trott

Copy link
Copy Markdown
Member

LGTM

Nit: Might as well add periods to the end of all the comment sentences and capitalize the first word (where it's not the name of a property!) for consistency. (And if not, then oh well, it will make a nice good first commit for someone else.)

@nwoltman

Copy link
Copy Markdown
Contributor

@eversojk Since you're already editing this file, would you mind fixing the typo on line 98 (fo -> of)?

@eversojk
eversojkforce-pushed the doc-path-format-more-examples branch from 4b0d410 to acfee9aCompareMarch 24, 2016 00:40
This change was to add upon the algorithm description of path.format
by adding examples for unix systems that clarified behavior in
various scenarios.
@eversojk
eversojkforce-pushed the doc-path-format-more-examples branch from acfee9a to 1cea17fCompareMarch 24, 2016 00:45
@eversojk

Copy link
Copy Markdown
ContributorAuthor

Sentences marked and typo fixed!

@r-52

r-52 commented Mar 24, 2016

Copy link
Copy Markdown
Contributor

LGTM

jasnell pushed a commit that referenced this pull request Apr 9, 2016
This change was to add upon the algorithm description of path.format
by adding examples for unix systems that clarified behavior in
various scenarios.
PR-URL: #5838
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
@jasnell

Copy link
Copy Markdown
Member

Landed in 820844d

@jasnelljasnell closed this Apr 9, 2016
MylesBorins pushed a commit that referenced this pull request Apr 11, 2016
This change was to add upon the algorithm description of path.format
by adding examples for unix systems that clarified behavior in
various scenarios.
PR-URL: #5838
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
@MylesBorinsMylesBorins mentioned this pull request Apr 11, 2016
MylesBorins pushed a commit that referenced this pull request Apr 20, 2016
This change was to add upon the algorithm description of path.format
by adding examples for unix systems that clarified behavior in
various scenarios.
PR-URL: #5838
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
@MylesBorinsMylesBorins mentioned this pull request Apr 20, 2016
MylesBorins pushed a commit that referenced this pull request Apr 20, 2016
This change was to add upon the algorithm description of path.format
by adding examples for unix systems that clarified behavior in
various scenarios.
PR-URL: #5838
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
This was referenced Apr 21, 2016
MylesBorins pushed a commit that referenced this pull request Apr 21, 2016
This change was to add upon the algorithm description of path.format
by adding examples for unix systems that clarified behavior in
various scenarios.
PR-URL: #5838
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
jasnell pushed a commit that referenced this pull request Apr 26, 2016
This change was to add upon the algorithm description of path.format
by adding examples for unix systems that clarified behavior in
various scenarios.
PR-URL: #5838
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Roman Klauke <romaaan.git@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docIssues and PRs related to the documentations.pathIssues and PRs related to the path subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

path, doc: More examples for path.format()

7 participants

@eversojk@Trott@jasnell@nwoltman@r-52@mscdex@MylesBorins