Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pollster

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pollster

A thin wrapper for the Huffington Post Pollster API

  • 0.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

node-pollster

A small Node.js wrapper for the Huffington Post Pollster API.

Installation

npm install pollster

Getting Started

var pollster = require('pollster')

See the current estimate of the president's job approval

pollster.charts({topic: 'obama-job-approval'}, function(resp){
  console.log(resp[0].estimates);
});

List charts about 2012 Senate races

pollster.charts({topic: '2012-senate'}, function(resp){
  console.log(resp);
});

List charts about Wisconsin

pollster.charts({state: 'WI'}, function(resp){
  console.log(resp);
});

Calculate the margin between Obama and Romney from a recent general election poll

pollster.polls({chart: '2012-general-election-romney-vs-obama'}, function(resp){
  var poll = resp[0],
    responses = poll.questions.filter(function(q) {
      return q.chart === '2012-general-election-romney-vs-obama';
    })[0].subpopulations[0].responses,
    obama = responses.filter(function(r) { return r.choice === 'Obama'; })[0],
    romney = responses.filter(function(r) { return r.choice === 'Romney'; })[0];

  console.log(obama.value - romney.value);
});

See the methodology used in recent polls about the Affordable Care Act

pollster.polls({chart:'us-health-bill'}, function(resp){
  console.log(resp.map(function(p) { return [p.pollster, p.method]; }));
});

License

See LICENSE.

The Huffington Post Pollster API is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. See this page for additional license and usage information.

Not affiliated with the Huffington Post.

FAQs

Package last updated on 18 Sep 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc