Created
July 27, 2022 16:36
-
-
Save Kas-tle/3aeddbce1359c202d0b81ac8456dcb2b to your computer and use it in GitHub Desktop.
Clean path for model
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
def cleanpath(inp): | |
inp | |
| split("/") | |
| del(.[0:2], .[3]) | |
| .[-1] = (.[-1] | split(".") | del(.[-1]) | reduce .[] as $item (""; . + ($item) + ".") | .[:-1]) | |
| reduce .[] as $item (""; . + ($item) + "/") | |
| .[:-1] | |
; | |
cleanpath(.) | |
#"./assets/mega/models/custom/item/test.alpha.json" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment