Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create Nodes Array #36

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

tenbits
Copy link
Contributor

@tenbits tenbits commented Mar 6, 2014

Create an array of nodes, instead of storing the node under UID property or random property.

var cal = ical.parseICS(str);
cal.vevent // <Array>

@peterbraden
Copy link
Owner

Hi, This breaks a bunch of the tests - can you take another look?

Thanks!

@tenbits
Copy link
Contributor Author

tenbits commented Mar 7, 2014

@peterbraden sure, if all the features from those 3 prs are acceptable, then I'll close them, merge und fix the tests. Cheers

@peterbraden
Copy link
Owner

The features are great - if we can get them in the test suite I'd be happy to pull them! Thanks for the PR's

@tenbits
Copy link
Contributor Author

tenbits commented Mar 15, 2014

Hi Peter, sorry for some delay, all the week I was at CeBIT. May I ask you, if it were possible:

  • to change all the tests to the utest runner
  • to break the library into some partial files as, for example, we do this at mask
  • to change the indention style code - to 4 spaces, or better to tabs.

These things are all not very important, but will make me much easier to work at the project. But is also OK, If only some, or even none, of the proposed changes you accept.

Cheers, Alex

@peterbraden
Copy link
Owner

I'd prefer not to make any changes as big as switching the test runner or changing spaces. I'd be happy to consider breaking the module out if it looked more manageable, but it might be better to do this as a separate PR to keep things clean.

Thanks.

@tenbits
Copy link
Contributor Author

tenbits commented Mar 23, 2014

@peterbraden , I have add id feature back, the tests are green know, but for the future it would be better to remove it and to rewrite the tests. As it is much better to store nodes in an array, then under random key names.

... and as we stick to the lowercase convetion of the properties, I transform the type also to lowercase

@peterbraden
Copy link
Owner

Can you explain a little bit about what this PR is actually doing?

The reason we are assigning a UID rather than storing in an array is to more closely match the spec:
https://tools.ietf.org/html/rfc5545

@tenbits
Copy link
Contributor Author

tenbits commented Apr 4, 2014

It adds array grouping by a type to the calendar instance. So that all, for example, BEGIN:VEVENT ... entries are stored in the array calendar.vevent. Firstly, It is semantically better and secondly, it is easier to perform some work on the array - loop, add events, remove events, etc.
Spec is good for storing(serialization/deserialization) rules, but in-memory data structure representation can be selected that, which better suites. And it is definitely the List<Item> structure. Or I miss something? ;) Cheers

@peterbraden
Copy link
Owner

I'm kinda torn on this because I want to keep this module completely focused on the serialization/deserialization aspect of this, I don't necessarily want to make assumptions about what will happen with the data. Is there a compelling reason to do this as part of the parsing, or is this something that applications can do afterwards?

@tenbits
Copy link
Contributor Author

tenbits commented Apr 5, 2014

My point was, that in-memory representation structure is not dependent on the spec in this case. I found nothing that says, that child object should be stored(in memory) under the correspondent UUID property in its parent. Or can you point me on this? So I assume, we can handle the calendar object as we "want", then storing Events, Todos etc. in an array structure is the only right way. Always think about the consumers of this module. E.g. how I know that a VTODO component is present, or how many of them are present? Loop over all keys in the calendar object and check the type? Is it not better just to use calendar.vtodo.length? Or what about loops, calendar.vevent.forEach approach is much better.
But if you want to stay with random uuid keys, than you should at least provide some calendar wrapper class to perform such simple tasks. Then you will notice, that arrays are good choice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants