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

Update newspapers.com.js to use json string #1929

Open
wants to merge 6 commits into
base: master
from

Conversation

Projects
None yet
3 participants
@pbinkley
Copy link
Contributor

pbinkley commented Apr 12, 2019

Closes #1927

pbinkley added some commits Apr 12, 2019

@pbinkley

This comment has been minimized.

Copy link
Contributor Author

pbinkley commented Apr 12, 2019

I'm not sure whether the attr() function is still needed, or what to do about the unused doc and url params that Travis doesn't like. I'd be happy to clean up further if someone can advise me.

@dstillman
Copy link
Member

dstillman left a comment

I didn't look at all of this, but some quick notes.

Show resolved Hide resolved newspapers.com.js Outdated
Show resolved Hide resolved newspapers.com.js Outdated
Show resolved Hide resolved newspapers.com.js Outdated
@pbinkley

This comment has been minimized.

Copy link
Contributor Author

pbinkley commented Apr 13, 2019

Thanks for the suggestions. I've cleaned up the code in accordance with them. The JSON.parse() problem is weird: because the source string is stringified (with escaped slashes etc.), I have to apply JSON.parse twice to get it into an object. If there's a cleaner way to achieve this I'd love to learn it.

newspapers.com: Some clean-up
Remove unused functions, variables, duplicate tests
@adam3smith

This comment has been minimized.

Copy link
Collaborator

adam3smith commented Apr 13, 2019

attr and text are no longer needed. The functions will work without the url parameter, but I'm pretty sure detectWeb does need doc so we'll need to escape the eslint rule there.
There was also something wonky about the tests -- somehow they had duplicated which caused the linter to fail.



function detectWeb(doc, url) {
function detectWeb(doc) {

This comment has been minimized.

Copy link
@adam3smith

adam3smith Apr 14, 2019

Collaborator

@dstillman what's your view on this? it's easy enough to eslint-escape locally, but this will be a pretty common issue, so might be worth changing globally? On the other hand, the may well be actual cases where doc is passed unnecessarily that'd be nice to catch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.