deasync-obj
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

deasync-obj

transforms object with promises values to object with resolved values.

Installation

npm install deasync-obj

(typescript ready, no need for @types/deasync-obj :))

Example

import { deasyncObj } from 'deasync-obj';

async function main() {
    const obj = {
        foo: {
            bar: Promise.resolve(5),
            baz: [6, Promise.resolve(7)]
        }
    };

    deasyncObj(obj).then(() => {
        console.log(obj);
    });


}

main();

This will print:

{ foo: { bar: 5, baz: [6, 7] } }

Package Sidebar

Install

npm i deasync-obj

Weekly Downloads

3

Version

1.0.1

License

ISC

Unpacked Size

5.91 kB

Total Files

4

Last publish

Collaborators

  • ofirel