Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

bowling

Package Overview
Dependencies
Maintainers
1
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bowling - npm Package Compare versions

Comparing version
1.2.0
to
1.2.1
+52
example.js
var lib = require './index',
progression = [
['8'],
['81'],
['81','9'],
['81','9/'],
['81','9/','9'],
['81','9/','9-'],
['81','9/','9-','7'],
['81','9/','9-','71'],
['81','9/','9-','71','x'],
['81','9/','9-','71','x','f'],
['81','9/','9-','71','x','f8'],
['81','9/','9-','71','x','f8','X'],
['81','9/','9-','71','x','f8','X','0'],
['81','9/','9-','71','x','f8','X','0/'],
['81','9/','9-','71','x','f8','X','0/','3'],
],
rolls = ['8','1','9','-','9','/',
'7','1','9','-','X',
'9','0','7','0','x',
'7','-'];
console.log(tt([['name', '1', '2', '3'],['tom', '9/', 'X', '3/'],['', '20','40','']],{align:['l','r','r','r']}))
[['name', '1', '2', '3'],['tom', '9/', 'X', '3/'],['', '20','40',''],['nee', '9/', 'X', '3/'],['', '20','40','']]
process.stdout.write('\033[2J')
function Game(){
this.frames = [];
}
Game.prototype.addRoll = function(roll){
var currentFrame;
if(this.frames.length === 0){
currentFrame = [];
}else{
currentFrame = this.frames[this.frames.length-1];
}
currentFrame.push(roll);
}
rolls.forEach(function(roll){
game.push(roll);
});
+5
-0
1.2.1 / 2014-04-13
==================
* test/testling, pkg, readme updates
1.2.0 / 2014-04-12

@@ -3,0 +8,0 @@ ==================

+21
-5
{
"name": "bowling",
"version": "1.2.0",
"description": "bowling scorekeeping module",
"version": "1.2.1",
"description": "ten-pin bowling scorekeeping module",
"main": "index.js",

@@ -18,8 +18,8 @@ "directories": {

"scoresheet",
"tenpin",
"ten-pin",
"bowling",
"score",
"scoring",
"sport",
"strike",
"spare"
"sport"
],

@@ -39,3 +39,19 @@ "author": {

"tap-spec": "^0.1.8"
},
"testling": {
"files": "test.js",
"browsers": [
"ie/8..latest",
"firefox/17..latest",
"firefox/nightly",
"chrome/22..latest",
"chrome/canary",
"opera/12..latest",
"opera/next",
"safari/5.1..latest",
"ipad/6.0..latest",
"iphone/6.0..latest",
"android-browser/4.2..latest"
]
}
}
+11
-4
# node-bowling
apply scoring logic to bowling results
apply scoring logic to ten-pin bowling results. handles both incomplete and complete games.

@@ -10,2 +10,4 @@ [![Build Status](https://travis-ci.org/tphummel/node-bowling.png)](https://travis-ci.org/tphumeml/node-bowling)

[![testling badge](https://ci.testling.com/tphummel/node-bowling.png)](https://ci.testling.com/tphummel/node-bowling)
# install

@@ -21,9 +23,13 @@

var bowl = require("bowling"),
game = ['81','9-','9/','71','9-','X','90','70','x','7-'],
var bowl = require('bowling');
var aCompleteGame = ['81','9-','9/','71','9-','X','90','70','x','7-'],
result;
result = bowl(game);
result = bowl(aCompleteGame);
console.log(result);
/*
[

@@ -41,2 +47,3 @@ {outcome: '81', cumulative: 9, score: 9},

]
*/

@@ -43,0 +50,0 @@ # notes

+19
-0

@@ -139,2 +139,21 @@ var test = require('tape'),

test('a complete game with all zero-spares', function(t){
var gm1 = ['0/','-/','0/','-/','-/','-/','-/','-/','-/','-/-'];
var result = lib(gm1);
var expected = [
{outcome: '-/', cumulative: 10, score: 10},
{outcome: '-/', cumulative: 20, score: 10},
{outcome: '-/', cumulative: 30, score: 10},
{outcome: '-/', cumulative: 40, score: 10},
{outcome: '-/', cumulative: 50, score: 10},
{outcome: '-/', cumulative: 60, score: 10},
{outcome: '-/', cumulative: 70, score: 10},
{outcome: '-/', cumulative: 80, score: 10},
{outcome: '-/', cumulative: 90, score: 10},
{outcome: '-/-', cumulative: 100, score: 10}
];
t.deepEqual(result, expected);
t.end();
});
test('zero frame', function(t){

@@ -141,0 +160,0 @@ var gm1 = ['--'];