For the below code:
var om = require('object-mapper');
var map = {
"id": {
"key": "destId",
"transform": function(id) {
return "_" + id;
} // ,
// "default": "0"
}
};
var src = {
// "id": 1
};
var dest = om(src, map);
console.log(JSON.stringify(dest));
As property id doesn't exist in src, I would expect an output of an empty object {}.
But the output generated is:
The null value sent to transform is a wrongly forced default value.
I have made changes to fix this issue. However, it broke one of the tests (test no. 70) for which I have made changes to make it successful. Will send a pull request. Please review. Thanks.
For the below code:
As property
iddoesn't exist insrc, I would expect an output of an empty object{}.But the output generated is:
The
nullvalue sent totransformis a wrongly forced default value.I have made changes to fix this issue. However, it broke one of the tests (test no. 70) for which I have made changes to make it successful. Will send a pull request. Please review. Thanks.