I have this array of object in typescript
[
{target_col: "`qsze`", operation: "", isNew: false, operationNotCompiled: "", index: 25},
{target_col: "`qsf`", operation: "", isNew: false, operationNotCompiled: "", index: 26},
{target_col: "`amiu`", operation: "'jnhghghgh'", isNew: true, operationNotCompiled: "'jnhghghgh'",…},
{target_col: "`amiu`", operation: "", isNew: false, operationNotCompiled: "", index: 27}
]
and I want to remove duplicate elements.
I want if there is no element duplicated return the object like it is.
else if there is elements duplicated remove the one that have operationNotCompiled=""
.
if there elements duplicated and the 2 elements have operationNotCompiled=""
then remove one.
2 elements duplicated=====>>> 2 elements have the same attribute target_col. like this 2.
{target_col: "`amiu`", operation: "'jnhghghgh'", isNew: true, operationNotCompiled: "'jnhghghgh'",…},
{target_col: "`amiu`", operation: "", isNew: false, operationNotCompiled: "", index: 27}