Commit b7f65896 b7f658961d510cbfc5dba721f592596abe3a3b06 by Vincent Peybernes

#9 Prepare publish - add README

1 parent 915a7f71
Pipeline #23 for b7f65896 passed in 52 seconds
# RelativePlacementJS
This library provide an placement system with the relative placement algorithm used in
West Coast Swing dance competitions.
## Understading relative placement
Relative placement is a placement system where electors (judges) provide there own placement
of each candidates.
The algorithm consist to search for each place a majority of votes for a candidate at this
placement or a greater placement.
You can refer to this explain from boogiebythebay.org for all the details.
## Get RelativePlacementJS
```shell
npm install relative-placement-js --save
```
With node:
```javascript
var RelativePlacement = require('relative-placement-js');
```
With browser:
```html
<script src="{BASE_PATH}/node_modules/relative-placement-js/dist/relative-placement.js"></script>
<!-- Or the original ES6 sources -->
<script src="{BASE_PATH}/node_modules/relative-placement-js/lib/relative-placement.js"></script>
```
With AngularJS:
```javascript
angular.module('myApp', ['relative-placement-js']).controller('MyCtrl', [
'$scope', 'RelativePlacement',
function($scope, RelativePlacement){
}
]);
```
## Use RelativePlacementJS
```javascript
var contest = new RelativePlacement();
contest.addCandidates(['A','B','C']);
contest.addCandidate('D');
contest.addVote(['A','B','C','D']);
contest.addVotes([
['A','B','C','D'],
['A','C','B','D'],
['A','B','D','C'],
['B','A','C','D'],
['B','A','D','C']
]);
var result = contest.getResult(); // return ['A','B','C','D'];
```
\ No newline at end of file
......@@ -7,7 +7,7 @@
if(global && module && module.exports) return module.exports = definition();
//Browser export
if(window){
if(angular && angular.version.major == 1) return angular.module('relativePlacement').factory('RelativePlacement', definition);
if(angular && angular.version.major == 1) return angular.module('relative-placement-js').factory('RelativePlacement', definition);
if(requirejs) return define(definition());
window.RelativePlacement = definition();
......