Created
December 6, 2014 04:31
-
-
Save Streemo/09c09e18817a0f17e455 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//ensure that the user does not put in too many '/' and ensures that only | |
//underground blips can be subblips of underground blips. | |
cleanPath = function(path){ | |
return path.split('/').reduce(function(prev,curr){ | |
if (curr!=''){ | |
if (prev.search('_')>-1){ | |
if (curr.search('_')>-1){ | |
return prev+=curr+'/'; | |
} else { | |
return prev+='_'+curr+'/'; | |
} | |
} else { | |
return prev+=curr+'/'; | |
} | |
} else { | |
return prev; | |
} | |
},''); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment