UNPKG

@visactor/vrender-core

Version:

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

19 lines (15 loc) 566 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: !0 }), exports.diff = void 0; const vutils_1 = require("@visactor/vutils"); function diff(oldAttrs, newAttrs, getAttr) { const diffObj = {}; for (const key in newAttrs) key in oldAttrs && (0, vutils_1.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; } exports.diff = diff;