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.26.1 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.26.0 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.26.0.rc2 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.26.0.rc1 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.25.2 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.25.1 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.25.0 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.25.0.rc4 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.25.0.rc3 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.25.0.rc2 app/packs/src/decidim/editor/attribute_diff.js
decidim-core-0.25.0.rc1 app/packs/src/decidim/editor/attribute_diff.js