How to use p-waterfall - 3 common examples

To help you get started, we’ve selected a few p-waterfall 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 ritz078 / embed-js / packages / embed-js / src / index.js View on Github external
text() {
    const options = this.resetOptions()
    const transformers = options.plugins.map(p => p.transform)
    return pWaterfall(transformers, options)
  }
github egoist / bili / src / index.ts View on Github external
const watcher = watch(configs)
      watcher.on('event', e => {
        if (e.code === 'ERROR') {
          logger.error(e.error.message)
        }
      })
    } else {
      try {
        if (options.concurrent) {
          await Promise.all(
            tasks.map(task => {
              return this.build(task, context, options.write)
            })
          )
        } else {
          await waterfall(
            tasks.map(task => () => {
              return this.build(task, context, options.write)
            }),
            context
          )
        }
      } catch (err) {
        spinner.stop()
        throw err
      }
    }

    return this
  }

p-waterfall

Run promise-returning & async functions in series, each passing its result to the next

MIT
Latest version published 3 years ago

Package Health Score

70 / 100
Full package analysis

Popular p-waterfall functions