Coder Social home page Coder Social logo

Comments (4)

jrogelstad avatar jrogelstad commented on June 11, 2024

I did a little investigation into various deep copy methods, as I'm sure you have as well, and my conclusion was that the more important it is for the copy to be "correct" the greater the overhead involved to implement it. For example here's a pretty involved algorithm to do deep copy:

http://oranlooney.com/static/javascript/deepCopy.js
...that is described here:
http://oranlooney.com/deep-copy-javascript/

I didn't run any tests, but just looking at it I'm sure it will slow the generator down substantially, which kind of defeats the main stated benefit of this project over others. For my project I just implemented a simple work around that converts all dates to JSON strings before the object ever gets to the observer/generator:

https://github.com/xtuple/xtuple/blob/master/lib/backbone-x/source/model.js#L331
https://github.com/xtuple/xtuple/blob/master/lib/backbone-x/source/model_mixin.js#L238

If I stumble upon a better idea I will circle back on this.

Best,

John

from json-patch.

warpech avatar warpech commented on June 11, 2024

I tried to fix it in the shimmed version, but I abandoned it because it won't run in the native (Object.observe) version anyway.

Reason: Object.observe can't detect changes in the Date object (tested in Chrome 28 and Chrome 30 Canary) - http://jsfiddle.net/ytz93/

from json-patch.

Starcounter-Jack avatar Starcounter-Jack commented on June 11, 2024

As Date is not a value type and as we want to be compatible with Ecmascript Next Object.observe, I'm now closing this. I'll reopen the issue if anyone can provide some compelling new insight on the subject.

from json-patch.

Toub avatar Toub commented on June 11, 2024

So, how do we generate patches for dates?
Maybe that custom comparison function could help: #92

from json-patch.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.