Skip to content

yariksav/promiseo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Library for resolve object with promises

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published