kewisch / ical.js

Javascript parser for ics (rfc5545) and vcard (rfc6350) data
https://kewisch.github.io/ical.js/
Mozilla Public License 2.0
991 stars 137 forks source link

When creating a component don't mutate original objects? #24

Closed lightsofapollo closed 11 years ago

lightsofapollo commented 12 years ago

When parsing then creating a component will be mutated. This means if you wish to parse pull out some data but save the original structure you have to call toJSON on the component to create a clean copy.

I think we could clone? The original objects so we don't mutate them during component creation I don't have a test case for this I merely observed it while writing some tests for my gaia code.

lightsofapollo commented 11 years ago

We changed this behavior sightly in Componentv2 so it intentionally mutations the objects but keeps them compatible with jCal so its the best of both worlds.