Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source property with value of false will map to destination property as null. #123

Closed
jmplahitko opened this issue May 8, 2020 · 3 comments

Comments

@jmplahitko
Copy link
Contributor

I'm submitting a...


[ ] Regression 
[x] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request

Current behavior

Source property with value of false will map to destination property as null.

Expected behavior

Source property with value of false should map to destination property as false.

Minimal reproduction of the problem with instructions


// Given this model...
class Product {
	@AutoMap() isBundle!: boolean;
}

// map some object
const dest = mapper.map({ isBundle: false }, Product, Product);
// dest = { isBundle: null } 

What is the motivation / use case for changing the behavior?

Boolean values should be preserved during mapping.

Environment


Version: 6.2.0
 
For Tooling issues:
- Node version: 10.15.3
- Platform:  Mac

Others:

@jmplahitko
Copy link
Contributor Author

@nartc - instantiate.ts line 21 seems to be the culprit. I'd fix, but I'm not sure of your intent here.

@nartc
Copy link
Owner

nartc commented May 8, 2020

Thanks for reporting. You're right. line 21 was me being dumb with null checking. The fix is already in but I'll try to get #124 resolved before pushing. Thanks again

@nartc nartc added the has PR label May 8, 2020
@nartc nartc closed this as completed in 6be63e3 May 8, 2020
@nartc
Copy link
Owner

nartc commented May 8, 2020

🎉 This issue has been resolved in version 6.2.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@nartc nartc added the released label May 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants