Closed nagarajanchinnasamy closed 5 years ago
For the following code:
var om = require('object-mapper'); var map = { "arr[].id": "arr[].id", "arr[].arr[].id": "arr[].arr[].id", "arr[].arr[].arr[].id": "arr[].arr[].arr[].id" }; var src = { "arr": [ { "id": 1 } ] }; var dest = om(src, map); console.log(JSON.stringify(dest));
as sub-array elements don't exist in src, the expected output would be:
src
{"arr":[{"id":1}]}
However, the generated output is:
{"arr":[{"id":1,"arr":[{"arr":[{}]}]}]}
I modified the code to fix this issue. Modifications do not break any of the tests :)
Will send a pull request. Please review. Thanks 👍
I've verified this as an issue and added your test. I hope to fix shortly.
This is fixed in my branch
For the following code:
as sub-array elements don't exist in
src
, the expected output would be:However, the generated output is:
I modified the code to fix this issue. Modifications do not break any of the tests :)
Will send a pull request. Please review. Thanks 👍