dmtrKovalenko/odiff

rm bug report

wxfred opened this issue · 2 comments

const a = [
  {},
  {},
  {
    "b": null,
    "i": 2587.884,
    "j": 89.2944,
    "k": 1254.2556,
    "l": 1880.97
  },
  {
    "b": null,
    "i": 386.11559999999986,
    "j": 1102.9512,
    "k": 1252.6019999999999,
    "l": 814.398
  },
  {
    "b": null,
    "i": 386.11559999999986,
    "j": 150.4776,
    "k": 1252.6019999999999,
    "l": 814.398
  },
  {}
]
const b = [
  {},
  {},
  {
    "b": "603c8f2d-db93-45ec-bea3-f6cd2f6be5b7",
    "i": 2587.825865625,
    "j": 89.2944,
    "k": 1254.37186875,
    "l": 1880.97
  },
  {
    "b": "3c1a45a6-b776-4a54-852a-6a4103105ddc",
    "i": 386.11559999999986,
    "j": 570.9921868791004,
    "k": 1252.6019999999999,
    "l": 1878.3160262417994
  },
  {
    "b": "5f3f02f7-e0e4-4a01-8126-73e33845f6cd",
    "i": 386.11559999999986,
    "j": -381.4814131208996,
    "k": 1252.6019999999999,
    "l": 1878.3160262417994
  },
  {}
]
console.log(odiff(a, b))

The result is

[{
  "type": "rm",
  "path": [],
  "index": 0,
  "num": 3,
  "vals": [{}, {}, {
    "b": null,
    "i": 2587.884,
    "j": 89.2944,
    "k": 1254.2556,
    "l": 1880.97
  }]
}, {
  "type": "add",
  "path": [],
  "index": 2,
  "vals": [{
    "b": "603c8f2d-db93-45ec-bea3-f6cd2f6be5b7",
    "i": 2587.825865625,
    "j": 89.2944,
    "k": 1254.37186875,
    "l": 1880.97
  }, {
    "b": "3c1a45a6-b776-4a54-852a-6a4103105ddc",
    "i": 386.11559999999986,
    "j": 570.9921868791004,
    "k": 1252.6019999999999,
    "l": 1878.3160262417994
  }, {
    "b": "5f3f02f7-e0e4-4a01-8126-73e33845f6cd",
    "i": 386.11559999999986,
    "j": -381.4814131208996,
    "k": 1252.6019999999999,
    "l": 1878.3160262417994
  }]
}]

It looks like you intent to open an issue for different project

Sorry for that.