reallysimple 0.4.4 → 0.4.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "reallysimple",
3
3
  "description": "Reads an RSS-like feed and calls back with a JavaScript structure, hiding all the history. It really is simple. ;-)",
4
- "version": "0.4.4",
4
+ "version": "0.4.7",
5
5
  "author": "Dave Winer <dave@scripting.com>",
6
6
  "license": "MIT",
7
7
  "files": [
package/readme.md CHANGED
@@ -22,21 +22,9 @@ There probably is a small tradeoff in performance, you can probably write faster
22
22
 
23
23
  Here's how you call the package.
24
24
 
25
- const reallysimple = require ("reallysimple");
25
+ ```javascript
26
26
 
27
- const url = "http://scripting.com/rss.xml";
28
-
29
- reallysimple.readFeed (url, function (err, theFeed) {
30
-
31
- if (!err) {
32
-
33
- console.log ("theFeed == " + JSON.stringify (theFeed));
34
-
35
- }
36
-
37
- }):
38
-
39
- Here's what shows up in the console when you run that code.
27
+ Here's <a href="https://github.com/scripting/reallysimple/blob/main/example/test.json">the file</a> that's created when you run that code.
40
28
 
41
29
  #### What we build on
42
30
 
@@ -48,6 +36,10 @@ This package further simplifies the struct returned by <a href="https://www.npmj
48
36
 
49
37
  #### Work notes
50
38
 
39
+ 4/7/22; 11:37:16 AM by DW
40
+
41
+ Clean up the readme file. Simplify the example app. Review docs. Start to invite collaborators to the repo, still private.
42
+
51
43
  3/21/22; 10:19:22 AM by DW
52
44
 
53
45
  Reviewing the way we represent links in items in the API.
package/readme.opml CHANGED
@@ -2,7 +2,7 @@
2
2
  <opml version="2.0">
3
3
  <head>
4
4
  <title>readme.md</title>
5
- <dateModified>Sun, 27 Mar 2022 16:05:47 GMT</dateModified>
5
+ <dateModified>Thu, 07 Apr 2022 15:38:10 GMT</dateModified>
6
6
  <expansionState></expansionState>
7
7
  <vertScrollState>1</vertScrollState>
8
8
  <windowTop>300</windowTop>
@@ -26,16 +26,8 @@
26
26
  </outline>
27
27
  <outline created="Mon, 07 Mar 2022 15:11:02 GMT" text="#### A coding example">
28
28
  <outline created="Mon, 07 Mar 2022 15:11:09 GMT" text="Here's how you call the package."></outline>
29
- <outline created="Mon, 07 Mar 2022 15:12:02 GMT" text="const reallysimple = require (&quot;reallysimple&quot;);"></outline>
30
- <outline created="Mon, 07 Mar 2022 15:12:17 GMT" text="const url = &quot;http://scripting.com/rss.xml&quot;;"></outline>
31
- <outline created="Mon, 07 Mar 2022 15:11:18 GMT" text="reallysimple.readFeed (url, function (err, theFeed) {">
32
- <outline created="Mon, 07 Mar 2022 15:12:40 GMT" text="if (!err) {">
33
- <outline created="Mon, 07 Mar 2022 15:12:44 GMT" text="console.log (&quot;theFeed == &quot; + JSON.stringify (theFeed));"></outline>
34
- <outline created="Mon, 07 Mar 2022 15:13:04 GMT" text="}"></outline>
35
- </outline>
36
- <outline created="Mon, 07 Mar 2022 15:11:54 GMT" text="}):"></outline>
37
- </outline>
38
- <outline created="Mon, 07 Mar 2022 15:10:30 GMT" text="Here's what shows up in the console when you run that code. "></outline>
29
+ <outline text="&lt;%includeExample (&quot;example1&quot;)%&gt;"></outline>
30
+ <outline created="Mon, 07 Mar 2022 15:10:30 GMT" text="Here's &lt;a href=&quot;https://github.com/scripting/reallysimple/blob/main/example/test.json&quot;&gt;the file&lt;/a&gt; that's created when you run that code. "></outline>
39
31
  </outline>
40
32
  <outline created="Mon, 07 Mar 2022 15:25:06 GMT" text="#### What we build on">
41
33
  <outline created="Mon, 07 Mar 2022 15:25:07 GMT" text="Thanks to Dan MacTough for the &lt;a href=&quot;https://www.npmjs.com/package/feedparser&quot;&gt;feedparser&lt;/a&gt; package."></outline>
@@ -43,6 +35,9 @@
43
35
  <outline created="Thu, 17 Mar 2022 15:46:06 GMT" text="This package further simplifies the struct returned by &lt;a href=&quot;https://www.npmjs.com/package/davefeedread&quot;&gt;davefeedread&lt;/a&gt;."></outline>
44
36
  </outline>
45
37
  <outline created="Sat, 05 Mar 2022 17:30:26 GMT" text="#### Work notes">
38
+ <outline created="Thu, 07 Apr 2022 15:37:15 GMT" text="4/7/22; 11:37:16 AM by DW">
39
+ <outline created="Thu, 07 Apr 2022 15:37:17 GMT" text="Clean up the readme file. Simplify the example app. Review docs. Start to invite collaborators to the repo, still private."></outline>
40
+ </outline>
46
41
  <outline created="Mon, 21 Mar 2022 14:19:22 GMT" text="3/21/22; 10:19:22 AM by DW">
47
42
  <outline created="Mon, 21 Mar 2022 14:19:22 GMT" text="Reviewing the way we represent links in items in the API. "></outline>
48
43
  <outline created="Mon, 21 Mar 2022 14:27:17 GMT" text="The question is this -- how can we get a link to the item from the item. "></outline>
package/reallysimple.js CHANGED
@@ -1,4 +1,4 @@
1
- var myProductName = "reallysimple"; myVersion = "0.4.4";
1
+ var myProductName = "reallysimple"; myVersion = "0.4.7";
2
2
 
3
3
  exports.readFeed = readFeed;
4
4
  exports.convertFeedToOpml = convertFeedToOpml;
@@ -21,7 +21,12 @@ var config = {
21
21
  }
22
22
 
23
23
  function isEmptyObject (obj) {
24
- return (Object.keys (obj).length === 0);
24
+ try {
25
+ return (Object.keys (obj).length === 0);
26
+ }
27
+ catch (err) {
28
+ return (true); //6/8/22 by DW
29
+ }
25
30
  }
26
31
  function getItemPermalink (item) {
27
32
  var rssguid = item ["rss:guid"], returnedval = undefined;
@@ -96,12 +101,18 @@ function convertFeed (oldFeed) {
96
101
  }
97
102
  return (theNewOutline);
98
103
  }
99
- function removeExtraAttributes (theOutline) {
100
- opml.visitAll (theOutline, function (theNode) {
104
+ function removeExtraAttributes (theNode) {
105
+ function visit (theNode) {
101
106
  if (theNode.flincalendar !== undefined) {
102
107
  delete theNode.flincalendar;
103
108
  }
104
- });
109
+ if (theNode.subs !== undefined) {
110
+ theNode.subs.forEach (function (sub) {
111
+ visit (sub);
112
+ });
113
+ }
114
+ }
115
+ visit (theNode);
105
116
  }
106
117
  function getHeadValuesFromFirstItem () { //3/6/22 by DW
107
118
  if (oldFeed.items.length > 0) {
@@ -144,8 +155,10 @@ function convertFeed (oldFeed) {
144
155
 
145
156
  getHeadValuesFromFirstItem (); //3/6/22 by DW
146
157
 
147
- if (isEmptyObject (newFeed.image)) {
148
- delete newFeed.image;
158
+ if (newFeed.image !== undefined) { //5/17/22 by DW
159
+ if (isEmptyObject (newFeed.image)) {
160
+ delete newFeed.image;
161
+ }
149
162
  }
150
163
 
151
164
  newFeed.items = new Array ();
@@ -176,8 +189,10 @@ function convertFeed (oldFeed) {
176
189
  }
177
190
  }
178
191
  newItem.guid = getItemPermalink (item);
179
- if (isEmptyObject (newItem.source)) {
180
- delete newItem.source;
192
+ if (newItem.source !== undefined) { //5/17/22 by DW
193
+ if (isEmptyObject (newItem.source)) {
194
+ delete newItem.source;
195
+ }
181
196
  }
182
197
  newFeed.items.push (newItem);
183
198
  });