Sha256: c6f4313fb0959da2a46d73cc865976f53b4f75a8e32c622d4d9cff96e24d168d

Contents?: true

Size: 797 Bytes

Versions: 31

Compression:

Stored size: 797 Bytes

Contents

/* eslint-disable require-jsdoc */

// ORGINAL: https://github.com/quilljs/delta/blob/ddda3bf088cda3ec03d5dbcc1179679d147f3a02/src/AttributeMap.ts
export default function attributeDiff(attributes1, attributes2) {
  let alpha = attributes1;
  let beta = attributes2;
  if (typeof alpha !== "object") {
    alpha = {};
  }
  if (typeof beta !== "object") {
    beta = {};
  }
  const attributes = Object.keys(alpha).concat(Object.keys(beta)).reduce((attrs, key) => {
    // ORGINAL: import isEqual from 'lodash.isequal'; if (!isEqual(a[key], b[key]))
    if ((alpha[key] !== beta[key])) {
      attrs[key] = null;
      if (beta[key]) {
        attrs[key] = beta[key]
      }
    }
    return attrs;
  }, {});

  if (Object.keys(attributes).length > 0) {
    return attributes;
  }
  return null;
}

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
decidim-core-0.27.9 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.27.8 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.27.7 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.27.6 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.26.10 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.26.9 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.27.5 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.26.8 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.27.4 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.27.3 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.26.7 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.26.5 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.27.2 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.27.1 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.26.4 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.27.0 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.26.3 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.27.0.rc2 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.27.0.rc1 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.26.2 app/packs/src/decidim/editor/attribute_diff.js