Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async function repoData(input, secondaryFlag) {
try {
const splitted = input.split('/')
if (splitted.length !== 5) return false
const [ owner, repo ] = takeLast(2, splitted)
console.log(repo)
const url = glue(
`
https://api.github.com
repos
${ owner }
${ repo }?access_token=${ process.env.GITHUB }
`,
'/'
)
const { status, data } = await get(url)
if (status > 200) return false
const packageJsonUrl = glue(
`
https://api.github.com
repos
const [ owner, repo ] = takeLast(2, splitted)
console.log(repo)
const url = glue(
`
https://api.github.com
repos
${ owner }
${ repo }?access_token=${ process.env.GITHUB }
`,
'/'
)
const { status, data } = await get(url)
if (status > 200) return false
const packageJsonUrl = glue(
`
https://api.github.com
repos
${ owner }
${ repo }
contents
package.json?access_token=${ process.env.GITHUB }
`,
'/'
)
let isLibrary
let isReact = false
let isTypescript = false
try {
const response = await get(packageJsonUrl)
function addToggleDetails(input){
const [ methodName ] = input.split('\n')
const testContent = getFileContent(`${ methodName }.spec`)
const methodContent = getFileContent(methodName)
if (!testContent || !methodContent) return input
const rawDetails = glue(`
<details>${ NEW_LINE }
<summary>
R.${ methodName } tests
</summary>${ NEW_LINE }
\`\`\`javascript
${ CONTENT_MARKER }
\`\`\`${ NEW_LINE }
</details>
`, '\n')
const rawMethodContent = glue(`
<details>${ NEW_LINE }
<summary>
R.${ methodName } source
</summary>${ NEW_LINE }
\`\`\`javascript</details>
const testContent = getFileContent(`${ methodName }.spec`)
const methodContent = getFileContent(methodName)
if (!testContent || !methodContent) return input
const rawDetails = glue(`
<details>${ NEW_LINE }
<summary>
R.${ methodName } tests
</summary>${ NEW_LINE }
\`\`\`javascript
${ CONTENT_MARKER }
\`\`\`${ NEW_LINE }
</details>
`, '\n')
const rawMethodContent = glue(`
<details>${ NEW_LINE }
<summary>
R.${ methodName } source
</summary>${ NEW_LINE }
\`\`\`javascript
${ CONTENT_MARKER }
\`\`\`${ NEW_LINE }
</details>
`, '\n')
const stillRawDetails = replace(CONTENT_MARKER, testContent, rawDetails)
const details = replace(new RegExp(NEW_LINE, 'gm'), '\n', stillRawDetails)
const stillRawMethodContent = replace(CONTENT_MARKER, methodContent, rawMethodContent)
const finalMethodContent = replace(new RegExp(NEW_LINE, 'gm'), '\n', stillRawMethodContent)
const withJavascriptTag = replace('```\n', '```javascript\n', input)