From 4481b56895b43d8aa18caf7514e738d3c6182388 Mon Sep 17 00:00:00 2001 From: Alex Kit Date: Thu, 6 Mar 2014 20:30:30 +0100 Subject: [PATCH 1/2] [++] create nodes array --- ical.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/ical.js b/ical.js index 6cbfb84..31cf9fe 100755 --- a/ical.js +++ b/ical.js @@ -166,11 +166,10 @@ var par = stack.pop() - if (curr.uid) - par[curr.uid] = curr - else - par[Math.random()*100000] = curr // Randomly assign ID : TODO - use true GUID - + if (par[curr.type] == null) + par[curr.type] = []; + + par[curr.type].push(curr); return par } From c4f05863a1fcd8f50f7efc7713e9b9823444d1c5 Mon Sep 17 00:00:00 2001 From: Alex Kit Date: Sun, 23 Mar 2014 23:02:09 +0100 Subject: [PATCH 2/2] [backward compatibility] nodes as uuid properties --- ical.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ical.js b/ical.js index 31cf9fe..e9098df 100755 --- a/ical.js +++ b/ical.js @@ -165,11 +165,19 @@ } var par = stack.pop() - - if (par[curr.type] == null) - par[curr.type] = []; - par[curr.type].push(curr); + // @deprecated, nodes will be stored in the lowercased `type` array + if (curr.uid) + par[curr.uid] = curr + else + par[Math.random()*100000] = curr // Randomly assign ID : TODO - use true GUID + // < + + var type = curr.type.toLowerCase(); + if (par[type] == null) + par[type] = []; + + par[type].push(curr); return par }