Giter Club home page Giter Club logo

maju's Introduction

maju 🗳️

maju (for majority judgment) is a Javascript library implementing the majority judgment voting system.

More info on majority judgment

Usage

Add maju to your project with npm i maju or yarn add maju

The exposed method allows to create a poll :

const createPoll = require('maju')
const myPoll = createPoll(['Matrix', 'Ghostbusters', 'Terminator', 'Stargate'])

Use the poll's vote() function to cast a vote. The object parameter must have a property for each poll option name. The value must be an integer between 0 and 5 (the higher the better, no "bad" or "excellent" rank to be speaking-language-independant).

myPoll.vote({ Matrix: 5, Stargate: 1, Ghostbusters: 0, Terminator: 2 })

Use the poll's getWinner() function to get the winner's name.

console.log(myPoll.getWinner())

Demo

⚠️ Don't forget to install dev dependancies with yarn or npm i

Refer to demo/index.js for an usage example

  • yarn demo:node for a node-only example
  • yarn demo for a browser usage example

Majority Judgment

Majority judgment is a single-winner voting system. Voters freely grade each candidate in one of several named ranks, for instance from "excellent" to "bad", and the candidate with the highest median grade is the winner.

Ressources

TODO

  • Create test suite (createPoll, votes, getSortedOptions)

maju's People

Contributors

romaindurand avatar

Stargazers

 avatar

Watchers

 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.