Title: Path should format when 'base' missing and 'name' and 'ext' exist · Issue #2305 · nodejs/node · GitHub
Open Graph Title: Path should format when 'base' missing and 'name' and 'ext' exist · Issue #2305 · nodejs/node
X Title: Path should format when 'base' missing and 'name' and 'ext' exist · Issue #2305 · nodejs/node
Description: This test shows that name and ext are not taken into account when using path.format without a base. The common usage this is preventing is this: var src = path.parse(srcpath) src.base = null if(src.ext === '') src.ext = '.js' src = path....
Open Graph Description: This test shows that name and ext are not taken into account when using path.format without a base. The common usage this is preventing is this: var src = path.parse(srcpath) src.base = null if(src...
X Description: This test shows that name and ext are not taken into account when using path.format without a base. The common usage this is preventing is this: var src = path.parse(srcpath) src.base = null if(src...
Opengraph URL: https://github.com/nodejs/node/issues/2305
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Path should format when 'base' missing and 'name' and 'ext' exist","articleBody":"This test shows that `name` and `ext` are not taken into account when using `path.format` without a `base`. \n\nThe common usage this is preventing is this:\n\n``` javascript\nvar src = path.parse(srcpath)\nsrc.base = null\nif(src.ext === '') src.ext = '.js'\nsrc = path.format(src)\n```\n\nHowever this doesn't do anything.\n\n``` javascript\nvar path = require('path')\nvar assert = require('assert')\n\n// pulled from https://nodejs.org/api/path.html#path_path_format_pathobject\n/* global describe, it */\n\ndescribe('node path', function () {\n\n it('should work as documented', function () {\n assert.equal(path.format({\n root: '/',\n dir: '/home/user/dir',\n base: 'file.txt',\n ext: '.txt',\n name: 'file'\n }), '/home/user/dir/file.txt')\n })\n\n it('should not work if missing base', function () {\n assert.notEqual(path.format({\n root: '/',\n dir: '/home/user/dir',\n ext: '.txt',\n name: 'file'\n }), '/home/user/dir/file.txt')\n })\n\n it('should show ext and name are irrelevant', function () {\n assert.equal(path.format({\n root: '/',\n dir: '/home/user/dir',\n ext: '.txt',\n name: 'file'\n }), path.format({\n root: '/',\n dir: '/home/user/dir'\n }))\n })\n\n})\n```\n\nhttps://github.com/nodejs/io.js/blob/master/lib/path.js#L584\n\nI can write a pull request, if anyone else thinks this is a good idea.\n","author":{"url":"https://github.com/reggi","@type":"Person","name":"reggi"},"datePublished":"2015-08-05T09:47:08.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/2305/node/issues/2305"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:0aa757e7-0ee9-741a-f86b-339d60e94b90 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8F0C:9C16A:13F566A:1D17425:6A4E442B |
| html-safe-nonce | 51357935473358e8788645da9892457629cd9c74e169b035fea490c390b17fc1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RjBDOjlDMTZBOjEzRjU2NkE6MUQxNzQyNTo2QTRFNDQyQiIsInZpc2l0b3JfaWQiOiIzMjk0NjMxMDA4OTQ3NTUzMzIzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 1d0344abceed9b8b1e89643d030260e2d1022422ffafdeb8151ddd5a9ee397ce |
| hovercard-subject-tag | issue:99166749 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nodejs/node/2305/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ecea5d35c35ec5b48be497105ebf1ae361bd51bdfb0bea2177508157731693c9/nodejs/node/issues/2305 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ecea5d35c35ec5b48be497105ebf1ae361bd51bdfb0bea2177508157731693c9/nodejs/node/issues/2305 |
| og:image:alt | This test shows that name and ext are not taken into account when using path.format without a base. The common usage this is preventing is this: var src = path.parse(srcpath) src.base = null if(src... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | reggi |
| hostname | github.com |
| expected-hostname | github.com |
| None | 030096ee0db095447bfe77409d33bfac127ca7128299c58deef27c52eaa1b1f0 |
| turbo-cache-control | no-preview |
| go-import | github.com/nodejs/node git https://github.com/nodejs/node.git |
| octolytics-dimension-user_id | 9950313 |
| octolytics-dimension-user_login | nodejs |
| octolytics-dimension-repository_id | 27193779 |
| octolytics-dimension-repository_nwo | nodejs/node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 27193779 |
| octolytics-dimension-repository_network_root_nwo | nodejs/node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 9fabff9b8b127e686a3ec86f91422e818056ca2c |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width