0

Im created an app using Vue and I have a some original data, and then a request which queries a php backend to check if any data has changed. Long story short I'm currently using lodash to compare two JSON objects

_.isEqual(x, y)

This all works fine! however what im looking for is if there is a way where I can input the current data and the new data and if the new data is different, output the part which is new. (data will only be added not removed).

here's my code (using vue):

detectChange(){
    this.fetchOrders().then(function(response) {
        return response
    }).then(function(data){
        console.log(_.isEqual(data, this.items))
        // ._isEqual works, I now just need to find difference if objects are different
    })
}
Christopher Moore
  • 15,626
  • 10
  • 42
  • 52
J.Pegg42
  • 1
  • 1

0 Answers0