JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q34377F
  • License ISC

Fetch Trump's latest approval rating from RCP. That’s all.

Package Exports

  • trump-approval

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (trump-approval) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Trump Approval Fetcher

Fetches Donald Trump’s latest approval ratings, scraping them from RealClearPolitics.

And that’s all.

Thanks to RCP for the open-ish JSONP API. Or maybe just don’t say anything.

Returns a Promise, which resolves to Object:

{
  date: Date,         // datetime of latest poll average, as reported by RCP)
  favorable: Float,   // percentage Favorable ratings (eg: 40.8% would be .408)
  unfavorable: Float  // percentage Unfavorabel ratings
}

Real example (note that date is being console.log'd but it is indeed a Date:

{
  date: 2019-02-13T06:00:00.000Z, // trust me, it's a Date
  favorable: 0.408,
  unfavorable: 0.554
}

You’ll probably get ECONNRESET errors if you try too much; RCP wasn’t born yesternanosecond.

See also: thetrump.report (trump-dot-report)