How to use the rambdax.mapAsync 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 selfrefactor / useful-javascript-libraries / src / indexProve.js View on Github external
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)
}
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 / 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 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),
  }))
github selfrefactor / useful-javascript-libraries / src / indexProve.js View on Github external
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, [