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 updateSecondaryFn(){
const { links } = readJSONSync(SECONDARY_INPUT)
const out = await mapAsync(async url => {
const { data } = await get(url)
return data.split('\n')
})(links)
const allLinks = flatten(out).join('\n')
writeFileSync(SECONDARY_OUTPUT, allLinks)
}
async function generateLinks(bookmarksContent){
const allLinks = bookmarksContent
.split('\n')
.s(reject(includes('gist.')))
.s(reject(includes('?tab')))
.s(reject(includes('trending')))
.s(filter(x => x.includes('github.com') || x.includes('npmjs')))
const withCorrectLinks = await mapAsync(async x => {
if (x.includes('github.com')) return x
const url = await toGithubURL(x)
return url
}, allLinks)
return withCorrectLinks.s(filter(Boolean)).s(
map(x => {
const replaced = replace(/(git:)|(ssh:)/, 'https:', x)
return remove('git@', replaced)
})
)
}
async function runBenchmarks(singleMethod){
const allBenchmarksList = filter(
x => ![ 'indexProve.js', 'benchmark_results' ].includes(x),
fs.readdirSync(__dirname)
).map(dropLast(3))
const allBenchmarks = singleMethod ? [ singleMethod ] : allBenchmarksList
await mapAsync(async singleBenchmark => {
const required = require(path.join(__dirname, `${ singleBenchmark }.js`))
console.log(singleBenchmark)
createBenchmark({ [ singleBenchmark ] : required })
})(allBenchmarks)
}
async function createScores(){
const { links, linksSecondary } = readJSONSync(LINKS)
const withRepoDataRaw = await mapAsync(repoDataModule, links)
const withRepoDataSecondaryRaw = await mapAsync(
repoDataSecondary,
linksSecondary
)
const withRepoData = withRepoDataRaw.filter(Boolean)
const withRepoDataSecondary = withRepoDataSecondaryRaw.filter(Boolean)
const score = withRepoData.map(x => ({
...x,
score : getScore(x, true),
}))
const scoreSecondary = withRepoDataSecondary.map(x => ({
...x,
score : getScore(x, true),
}))
async function createScores(){
const { links, linksSecondary } = readJSONSync(LINKS)
const withRepoDataRaw = await mapAsync(repoDataModule, links)
const withRepoDataSecondaryRaw = await mapAsync(
repoDataSecondary,
linksSecondary
)
const withRepoData = withRepoDataRaw.filter(Boolean)
const withRepoDataSecondary = withRepoDataSecondaryRaw.filter(Boolean)
const score = withRepoData.map(x => ({
...x,
score : getScore(x, true),
}))
const scoreSecondary = withRepoDataSecondary.map(x => ({
...x,
score : getScore(x, true),
}))
const toSave = uniqWith((a, b) => a.name === b.name, [