How to use the diff.convertChangesToXML function in diff

To help you get started, we’ve selected a few diff examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jimthedev / angular2-falcor-webpack-builder / n2f-src / client / falcor-app / app.ts View on Github external
getFormattedDiff(oldObject, newObject): string {
    let oldJson = JSON.stringify(oldObject, null, 4);
    let newJson = JSON.stringify(newObject, null, 4);

    // TODO: remove if angular supports styling inner-html
    // This is an icky hack but we must do it since Angular doesn't
    // currently apply View styles to nodes inserted via inner-html
    return JsDiff.convertChangesToXML(JsDiff.diffLines(oldJson, newJson)) + 
      `\n<style>
        ins { 
          text-decoration:none;
          color: #4F8A10;
          background-color: #DFF2BF;
        } 
        del { 
          color: #D8000C;
          background-color: #FFBABA;
        }
      </style>`;
  }
github checkr / flagr / browser / flagr-ui / src / components / FlagHistory.vue View on Github external
getDiff(newFlag, oldFlag) {
      const o = JSON.parse(JSON.stringify(oldFlag));
      const n = JSON.parse(JSON.stringify(newFlag));
      const d = diffJson(o, n);
      if (d.length === 1) {
        return "No changes";
      }
      return convertChangesToXML(d);
    }
  },