From c81bc60865cbdd25ad08bde15dfef9461610f328 Mon Sep 17 00:00:00 2001 From: Martin Bielik Date: Sun, 14 Oct 2018 14:09:48 +0200 Subject: [PATCH] v1.3.1 --- lib/helpers.js | 4 ++++ package.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/helpers.js b/lib/helpers.js index 0bc1b7b..12e1854 100644 --- a/lib/helpers.js +++ b/lib/helpers.js @@ -31,6 +31,10 @@ var includeProps = exports.includeProps = function includeProps(target, props) { * Computes appropriate font size of tag. */ var fontSizeConverter = exports.fontSizeConverter = function fontSizeConverter(count, min, max, minSize, maxSize) { + if (max - min === 0) { + // handle devision by zero + return Math.round((minSize + maxSize) / 2); + } return Math.round((count - min) * (maxSize - minSize) / (max - min) + minSize); }; diff --git a/package.json b/package.json index 6494af0..cefd9ab 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-tagcloud", - "version": "1.3.0", + "version": "1.3.1", "description": "Tag/word cloud component for react", "main": "lib/index.js", "scripts": {