Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const isPreviousSameType =
getType(node) === (previous && getType(previous))
createPage({
path: node.frontmatter.path,
component: pageTemplate,
context: {
type: getType(node),
next: isNextSameType ? next : null,
previous: isPreviousSameType ? previous : null,
},
})
}, sortedPages)
// Create tag pages
const tags = filter(
tag => not(isNil(tag)),
uniq(flatMap(post => post.frontmatter.tags, posts)),
)
forEach(tag => {
const postsWithTag = posts.filter(
post =>
post.frontmatter.tags && post.frontmatter.tags.indexOf(tag) !== -1,
)
paginate({
createPage,
items: postsWithTag,
component: tagsTemplate,
itemsPerPage: siteMetadata.postsPerPage,
pathPrefix: `/tag/${toKebabCase(tag)}`,
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 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 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)
})
)
}