Skip to content

How to get an array of objects with key to show diff? #19

@rmtuckerphx

Description

@rmtuckerphx

I have the following code:

var diffJson = require("diff-json")

oldArray = [
  {
    "id": "a",
    "count": 1
  },
  {
    "id": "b",
    "count": 0
  }
];

newArray = [
  {
    "id": "b",
    "count": 1
  },
  {
    "id": "a",
    "count": 3
  }
];

var diffs = diffJson.diff(oldArray, newArray);

And the result is showing as:

[Object {changes: [, ], embededKey: "$index", key: "$root", type: "update"}]

What should the call to .diff be?
What do the other params (path, embededObjKeys, keyPath) mean?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions