Skip to content

Instantly share code, notes, and snippets.

@Streemo
Created December 6, 2014 04:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Streemo/09c09e18817a0f17e455 to your computer and use it in GitHub Desktop.
Save Streemo/09c09e18817a0f17e455 to your computer and use it in GitHub Desktop.
//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