# compare-entity **Repository Path**: xshe/compare-entity ## Basic Information - **Project Name**: compare-entity - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-02-08 - **Last Updated**: 2021-02-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ## Compare Entity compare entity 是能对比两个超大且复杂的嵌套对象的工具: 1. 支持任意的结构 2. 能自定义排除比较字段 3. 提供模糊字段排除或者绝对路径排除 4. 反馈比较时长 5. 打印出所有不匹配的字段 使用方式如下: ```javascript 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"]); ``` 运行截屏: ![](https://s3.ax1x.com/2021/02/07/ytLvVJ.png)