aogriffiths / jsondiff-js

A JavaScript implementation to create json patches of the JSON Media Type for partial modifications: http://tools.ietf.org/html/draft-ietf-appsawg-json-patch-08. See also https://github.com/bruth/jsonpatch-js.
https://github.com/aogriffiths/jsondiff-js
BSD 2-Clause "Simplified" License
23 stars 11 forks source link

Arrays are ignored if named as property `messages` #3

Closed thejhh closed 10 years ago

thejhh commented 10 years ago

Looks like arrays are ignored if they are named as property messages:

> require('json-diff-patch').diff({ messages: [] }, { messages: [ { subject: 'Hello', body: 'This is a test message.' } ] });
[]

> require('json-diff-patch').diff({ messages: [1,2,3] }, { messages: [2,3,4] });
[]

However it seems to be working if named for example as a:

> require('json-diff-patch').diff({ a: [] }, { a: [ { subject: 'Hello', body: 'This is a test message.' } ] });
[ { op: 'add',
    path: '/a/0',
    value: 
     { subject: 'Hello',
       body: 'This is a test message.' } } ]
thejhh commented 10 years ago

This sounds like the same issue as issue #2, just different property.