# path.split implementation #2766

Closed
wants to merge 2 commits into
from
+53 −0

None yet

### 9 participants

commented Feb 16, 2012
 I added an implementation to create a split method in the path module. This is created based on #1224. I ask for input @isaacs @bnoordhuis
 gero3 "create path.split for both windows and posix" 7437d94
commented Feb 18, 2012
 I like the basic idea here. However, I think that it needs a bit more refinement. It should be called 'path.parse' rather than 'path.split', since that's what it's doing. path.split would just be p.split(/\/+/) on unix, and p.split(/[\/\\]+/) on windows. This is turning it into an object, which is very useful, but different. If there's a path.parse, then there should be a symmetrical path.format that turns the object into a string. Please make sure that the code lints properly. There's a lot of extra spaces lining things up: don't do that. The unix result is kind of weird. There's really no "device" in the path on unix, so that should probably just be left out. It needs tests (a lot, especially really weird chars etc.) and documentation. @igorzi, @piscisaureus Do you feel that this captures the appropriate information about a windows path?
 gero3 "add improvements" f1283d3
 Can one of the admins verify this patch?
 What's the status on this? (poke @gero3 )
commented Jul 19, 2013
 @ronkorving @gero3 It's still waiting for someone to get it over the finishline. Requirements: Add path.format which does the inverse of path.parse. A buttload of tests. Rebase onto current master. make jslintfix to fix the style issues.
commented Jul 19, 2013
 I'll have another look at it tonight
commented Dec 7, 2013
 I'd take a stab at implementing this since @gero3 seems to be out of the game. Tho I am not sure what the "device" for UNC paths should be. \mycomp\a\path\to\file.js is going to be parsed oddly in this commit ("\mycomp\a"), should the device be "\mycomp" or ""?
Member
commented Mar 18, 2014
 ping ;)
commented Mar 18, 2014