Skip to content
thromise / 1.2.0

thromise 1.2.0

Install from the command line:
Learn more about npm packages
$ npm install @qiwi/thromise@1.2.0
Install via package.json:
"@qiwi/thromise": "1.2.0"

About this version

thromise

Problem*

The Ugly.

const a = fn('foo')
  .then(r => b(r, 'bar')
    .then(/* ... */))

The Bad.

const a = await fn('foo')
const b = await fn(a, 'bar')

The good.

loop(t => {
  const f = t(fn)
  
  const a = f('foo')
  const b = f(a, 'bar')
})

*This is just our in-joke in the context of the Java vs JS holywar

Install

yarn add thromise

Usage

import { loop } from 'thromise'

const a = (v, d) => new Promise((resolve, reject) => setTimeout(() => resolve(v), d))
const b = v => v

loop((t) => {
  const [_a, _b] = t(a, b)
  console.log(
    _a('foo', 1000),
    _b('quz'),
    _a('bar', 500),
    _a('baz', 500),
  )
})

License

MIT

Details


Assets

  • thromise-1.2.0.tgz

Download activity

  • Total downloads 0
  • Last 30 days 0
  • Last week 0
  • Today 0