-
-
Save brunosabot/cbfecba9765c20c48a25815df7cb2578 to your computer and use it in GitHub Desktop.
This file contains 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
async function loadAndTransformGist(parent: IAST, item: IAST): Promise<IAST> { | |
if (item.value === undefined) return item; | |
const gist = item.value.substring(5).trim(); | |
const [data, jsonData] = await loadGist(gist); | |
if (data.length === 1) { | |
return getGistAST(jsonData.files[0], data[0]); | |
} | |
return { | |
type: parent.type, | |
children: data.map((file, index) => | |
getGistAST(jsonData.files[index], file) | |
), | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment