New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

d20

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d20 - npm Package Compare versions

Comparing version
1.4.0
to
1.4.1
+11
-2
d20.js

@@ -20,3 +20,3 @@ /**

* - dice syntax (d20, 4d6, 2d8+2)
* @param verbose Whether or not all dice rolls should be returned as an array
* @param verbose Whether or not all dice rolls should be returned as an array
* @return Number|Array

@@ -79,4 +79,13 @@ */

if (isNaN(dice)) {
return [];
}
for (var i = 0; i < amount; i++) {
num = Math.floor(Math.random() * dice + 1);
/* We dont want to ruin verbose, so we dont skip the for loop */
if(dice !== 0){
num = Math.floor(Math.random() * dice + 1);
}else{
num = 0;
}
results.push(num);

@@ -83,0 +92,0 @@ }

+1
-1
{
"name": "d20",
"version": "1.4.0",
"version": "1.4.1",
"description": "Library for rolling dice based on dice-syntax used in RPGs.",

@@ -5,0 +5,0 @@ "main": "d20.js",

@@ -1,5 +0,8 @@

# d20.js [![Build Status](https://travis-ci.org/michaelenger/d20.js.svg?branch=master)](https://travis-ci.org/michaelenger/d20.js)
# d20.js
Javascript library for rolling RPG dice. Supports dice notation such as "4d6" and "d20+2".
[![npm version](http://img.shields.io/npm/v/d20.svg?style=flat)](https://npmjs.org/package/d20)
[![Build Status](http://img.shields.io/travis/michaelenger/d20.js.svg?style=flat)](https://travis-ci.org/michaelenger/d20.js)
## Installation

@@ -61,3 +64,3 @@

d20.verboseRoll(20);
d20.verboseRoll('4d6);
d20.verboseRoll('4d6');
d20.verboseRoll('2d8+1');

@@ -64,0 +67,0 @@ d20.verboseRoll('1d8 +1 +2 -20');

@@ -86,4 +86,14 @@ /**

});
it('returns 0 if passed undescipherable text', function() {
var result = d20.roll('i can have a banana?');
expect(result).toBe(0);
});
it('returns empty array if passed undescipherable text', function() {
var result = d20.roll('did someone steal your sweetroll?', true);
expect(result.length).toBe(0);
});
});
})();