Skip to content

Commit

Permalink
removed need for require('summarizer').getPage
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew Kemp committed May 13, 2017
1 parent c1b196e commit 4cee7f5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const summarizeArticle = (title, story) => {
})
}

const superagentGetP = (uri) => {
const superAgentGet = (uri) => {
return new Promise((Resolve, Reject) => {
superagent.get(uri)
.end((err, res) => {
Expand All @@ -23,9 +23,9 @@ const superagentGetP = (uri) => {
})
}

module.exports.getPage = (uri) => {
module.exports = (url) => {
return new Promise((Resolve, Reject) => {
superagentGetP(uri)
superAgentGet(url)
.then(data => {
const text = data.text
let pageContent = unfluff(text)
Expand All @@ -34,9 +34,11 @@ module.exports.getPage = (uri) => {
summarizeArticle(pageContent.title, pageContent.text)
.then((res) => {
pageContent.summary = res
Resolve(pageContent)
}, Reject)
}, Reject)
return Resolve(pageContent)
})
.catch(err => Reject)
})
.catch(err => Reject)
})
}

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "summarizer",
"version": "3.0.0",
"version": "4.0.0",
"description": "Scrapes a remote page and creates a summary with statistics.",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 4cee7f5

Please sign in to comment.