How to use the rambdax.filter function in rambdax

To help you get started, we’ve selected a few rambdax examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github panr / gatsby-starter-hello-friend / gatsby-node.js View on Github external
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)}`,
github selfrefactor / rambda / benchmarks / indexProve.js View on Github external
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)
}
github selfrefactor / useful-javascript-libraries / src / indexProve.js View on Github external
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)
    })
  )
}
github selfrefactor / useful-javascript-libraries / src / indexProve.js View on Github external
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)
    })
  )
}