Created
October 28, 2022 20:27
-
-
Save zacjones93/e5d005d13adcdc84917611eb9a98ace6 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
// Author: Zac Jones | |
import "@johnlindquist/kit" | |
let input = await arg("paste in SMTP training") | |
let split = input.split(/(LIFTING:)|(WORKOUT:)|(WARM UP:)|(COOL DOWN:)/).filter((v) => !!v).reduce((prev, curr, i, arr) => { | |
if (i % 2 === 0) { | |
let key = curr.split(":") | |
return { | |
...prev, | |
[key[0]]: '' | |
} | |
} else { | |
let key = arr[i - 1].split(":") | |
return { | |
...prev, | |
[key[0]]: curr | |
} | |
} | |
}, {}) | |
let tanaWorkouts = ['%%tana%%\n'] | |
Object.keys(split).map((key) => { | |
let workout = ` | |
- ${key} #workout | |
- Description:: ${split[key]} | |
- Programming:: [[SMTP]]` | |
- Movements:: | |
- Score Scheme:: | |
- Time Scheme:: | |
- Rep Scheme:: | |
` | |
tanaWorkouts.push(workout) | |
}) | |
copy(tanaWorkouts.join("")) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment