UNPKG

@visactor/vrender-core

Version:

```typescript import { xxx } from '@visactor/vrender-core'; ```

12 lines (11 loc) 464 B
import { isEqual } from "@visactor/vutils"; export function diff(oldAttrs, newAttrs, getAttr) { const diffObj = {}; for (const key in newAttrs) key in oldAttrs && isEqual(oldAttrs[key], newAttrs[key]) || (diffObj[key] = newAttrs[key]); if (getAttr) for (const key in oldAttrs) if (!(key in newAttrs)) { const value = getAttr(key); void 0 !== value && (diffObj[key] = value); } return diffObj; } //# sourceMappingURL=diff.js.map