Last active
August 29, 2015 14:21
-
-
Save jlord/0dcf81f1c7030bbbf336 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
var path = 'atom-electron-b4403fa/docs/api/accelerator.md' | |
// wanted: 'docs/latest/api/accelerator' | |
// - add 'latest/' after 'docs/' | |
// - remove 'atom-electron-b443fa' | |
// - remove file extension at the end | |
function constructRedirectUrl (path) { | |
var a = path.split('/') | |
a.splice(2, 0, 'latest').splice(0, 1) | |
var c = a.join('/') | |
var d = c.split('.') | |
return d.shift() | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment