nartc / mapper

🔥 An Object-Object AutoMapper for TypeScript 🔥
https://automapperts.netlify.app/
MIT License
961 stars 84 forks source link

feat(core): Add async mapping support with Promises #617

Open koenigstag opened 2 months ago

koenigstag commented 2 months ago

Description

As a developer, I want my async mappings to work, so I've added promise support.

Proposed Changes

Implement a new boolean parameter isAsync to indicate a request for async operations.

Add conditional return of Promise which does async mapping operations inside.

Add type safety for return value with typescript conditional types.

Checklist

sonarcloud[bot] commented 2 months ago

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

koenigstag commented 2 months ago

Quoting the fake-async docs:

Real async support can be achieved by some Isomorphic Worker that would execute the map operations on the Worker thread

Can someone please explain - why do we need a Node.js Worker thread instead of Promise which are more common?