-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from ndaidong/v6.x.x
v6.0.0rc2
- Loading branch information
Showing
6 changed files
with
85 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
// [email protected].0rc1, by @ndaidong - built with esbuild at 2022-07-12T14:34:09.025Z - published under MIT license | ||
// [email protected].0rc2, by @ndaidong - built with esbuild at 2022-07-16T03:09:04.163Z - published under MIT license | ||
var __create = Object.create; | ||
var __defProp = Object.defineProperty; | ||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor; | ||
|
@@ -14585,46 +14585,50 @@ var isValidUrl_default = (url = "") => { | |
|
||
// src/main.js | ||
var eventEmitter = new import_events.default(); | ||
var runWhenComplete = (result, url) => { | ||
eventEmitter.emit("complete", result, url); | ||
var runWhenComplete = (url, result = null, error2 = null) => { | ||
eventEmitter.emit("complete", url, result, error2); | ||
return result; | ||
}; | ||
var read = async (url) => { | ||
try { | ||
if (!isValidUrl_default(url)) { | ||
eventEmitter.emit("error", { | ||
const erdata = { | ||
error: "Error occurred while verifying feed URL", | ||
reason: "Invalid URL" | ||
}, url); | ||
return runWhenComplete(null, url); | ||
}; | ||
eventEmitter.emit("error", url, erdata); | ||
return runWhenComplete(url, null, erdata); | ||
} | ||
const xml = await retrieve_default(url); | ||
if (!validate(xml)) { | ||
eventEmitter.emit("error", { | ||
const erdata = { | ||
error: "Error occurred while validating XML format", | ||
reason: "The XML document is not well-formed" | ||
}, url); | ||
return runWhenComplete(null, url); | ||
}; | ||
eventEmitter.emit("error", url, erdata); | ||
return runWhenComplete(url, null, erdata); | ||
} | ||
try { | ||
const feed = parse(xml); | ||
if (feed) { | ||
eventEmitter.emit("success", feed, url); | ||
eventEmitter.emit("success", url, feed); | ||
} | ||
return runWhenComplete(feed, url); | ||
return runWhenComplete(url, feed); | ||
} catch (er) { | ||
eventEmitter.emit("error", { | ||
const erdata = { | ||
error: "Error occurred while parsing XML structure", | ||
reason: er.message | ||
}, url); | ||
return runWhenComplete(null, url); | ||
}; | ||
eventEmitter.emit("error", url, erdata); | ||
return runWhenComplete(url, null, erdata); | ||
} | ||
} catch (err) { | ||
eventEmitter.emit("error", { | ||
const erdata = { | ||
error: "Error occurred while retrieving remote XML data", | ||
reason: err.message | ||
}, url); | ||
return runWhenComplete(null, url); | ||
}; | ||
eventEmitter.emit("error", url, erdata); | ||
return runWhenComplete(url, null, erdata); | ||
} | ||
}; | ||
var onComplete = (fn) => { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"name": "feed-reader-cjs", | ||
"version": "6.0.0rc1", | ||
"version": "6.0.0rc2", | ||
"main": "./feed-reader.js" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters