Open vlamic opened 5 years ago
+1 for this feature, it is nice to be able to ignore properties but since they are still displayed it seems as if both left and right objects have the same value which is incorrect.
Having a displayFilter
would be nice?
Note: right now I am using lodash omit to exclude those properties but this works out of the box only on top properties so not ideal
Hi @vlamic,
Could you please explain how you have implemented the propertyFilter to exclude certain fields? your help much appreciated?
Thanks
@prasanmgc you just need to do propertyFilter: name => !['field1', 'field2'].includes(name)
and field1
/field2
won't be compared
Thanks a lot @mebibou. It worked. you saved my time.
@mebibou Just a quick question. Is it possible to reference the ignored fields from a class variable? I am getting an error when i use the below.
propertyFilter: function (name: string) { !this.ignoredFields.includes(name); }
TypeError: Cannot read property 'ignoredFields' of undefined
@prasanmgc I suggest you read first what this
refers to in JavaScript to understand the error. But you should do this instead
var ignoredFields = [];
create({
propertyFilter(name: string) { return !ignoredFields.includes(name); }
});
@mebibou @prasanmgc property filter doesn't remove the fields from the nested objects, did it work for you for nested objects too?
First of all - thanks for your library - it rocks! ❤️
I have a question. I know it's possible to use
propertyFilter
to exclude certain fields from participating in diff. However, these fields are still present in the resulting diff (applies for added elements). Is there an option to also exclude these field for these added elements?Thanks!