compare-entity
v1.0.2
Published
Compare two complex objects value
Downloads
1
Readme
Compare Entity
compare entity 是能对比两个超大且复杂的嵌套对象的工具:
- 支持任意的结构
- 能自定义排除比较字段
- 提供模糊字段排除或者绝对路径排除
- 反馈比较时长
- 打印出所有不匹配的字段
使用方式如下:
import { compareEntity } from 'compare-entity';
compareEntity([{ id: 1 }], [{ id: 1 }]);
compareEntity([{ id: 1, item: { name: 'me' } }], [{ id: 4, item: { name: 'me2' } }], ["root->item->name"]);
compareEntity([{ id: 1, item: { name: 'me' } }], [{ id: 3, item: { name: 'me1' } }], ["root->item->name"]);
compareEntity([{ id: 1, item: { name: [{ key: '1' }, { key: '3' }] } }], [{ id: 2, item: { name: [{ key: '2' }, { key: '3' }] } }], ["key"]);
运行截屏: