promiseo

0.1.2 • Public • Published

promiseo

Library for resolve object with promises

Install

npm install promiseo --save-dev

Usage

import promiseo from 'promiseo'
  const somePromiseFunction = new Promise((resolve) => {
    ...
    resolve('test')
  })
 
  const someAsyncFunction = async () => {
    ...
    return ['1', '2']
  }
 
  const someAsyncFunctionThatReturnsObject = async () => {
    ...
    return {
      param1: 1
      param2: 2
    }
  }
 
  const result = promiseo({
    foo: somePromiseFunction(),
    bar: someAsyncFunction(),
    simpleString: 'foo', // simple type param
    simpleObject: { test: 1 }, // simple object
    '...': someAsyncFunctionThatReturnsObject()
  })

The result will be

  {
    foo: 'test',
    bar: ['1', '2']
    simpleString: 'foo',
    simpleObject: { test: 1 },
    param1: 1,
    param2: 2
  }

License

MIT

Package Sidebar

Install

npm i promiseo

Weekly Downloads

0

Version

0.1.2

License

MIT

Unpacked Size

18 kB

Total Files

8

Last publish

Collaborators

  • yariksav