Git Product home page Git Product logo

node-pollster's Introduction

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.

node-pollster's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.