alea-random
Advanced tools
Comparing version 2.1.6 to 3.0.0
14
index.js
@@ -1,4 +0,6 @@ | ||
var Alea = require('alea'); | ||
var isIterateeCall = require('lodash._isiterateecall'); | ||
var toNumber = require('lodash.tonumber'); | ||
'use strict'; | ||
const Alea = require('alea'); | ||
const isIterateeCall = require('lodash._isiterateecall'); | ||
const toNumber = require('lodash.tonumber'); | ||
const { v4: uuid } = require('uuid'); | ||
@@ -35,3 +37,3 @@ | ||
function aleaRandom(min, max, floating) { | ||
var gen = new Alea(uuid()); | ||
const gen = new Alea(uuid()); | ||
@@ -69,3 +71,3 @@ if (floating && typeof floating !== 'boolean' && isIterateeCall(min, max, floating)) { | ||
if (min > max) { | ||
var temp = min; | ||
const temp = min; | ||
min = max; | ||
@@ -76,3 +78,3 @@ max = temp; | ||
if (floating || min % 1 || max % 1) { | ||
var rand = gen(); | ||
const rand = gen(); | ||
return Math.min(min + (rand * (max - min + parseFloat('1e-' + ((rand + '').length - 1)))), max); | ||
@@ -79,0 +81,0 @@ } |
@@ -1,2 +0,2 @@ | ||
Copyright 2014 Kenan Yildirim <http://kenany.me/> | ||
Copyright 2014–2022 Kenan Yildirim <https://kenany.me/> | ||
@@ -18,2 +18,2 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
{ | ||
"name": "alea-random", | ||
"version": "2.1.6", | ||
"version": "3.0.0", | ||
"description": "`lodash.random` but using Alea", | ||
@@ -12,3 +12,3 @@ "keywords": [ | ||
"license": "MIT", | ||
"author": "Kenan Yildirim <kenan@kenany.me> (http://kenany.me/)", | ||
"author": "Kenan Yildirim <kenan@kenany.me> (https://kenany.me/)", | ||
"main": "index.js", | ||
@@ -22,2 +22,5 @@ "files": [ | ||
}, | ||
"engines": { | ||
"node": "12 || 14 || >=16" | ||
}, | ||
"scripts": { | ||
@@ -39,20 +42,19 @@ "lint": "eslint *.js test/*.js", | ||
"devDependencies": { | ||
"@kenan/eslint-config": "9.0.4", | ||
"@kenan/renovate-config": "1.5.1", | ||
"@semantic-release/changelog": "6.0.0", | ||
"@semantic-release/git": "10.0.0", | ||
"browserify": "17.0.0", | ||
"conventional-changelog-conventionalcommits": "4.6.1", | ||
"@kenan/eslint-config": "^9.0.4", | ||
"@semantic-release/changelog": "^6.0.1", | ||
"@semantic-release/git": "^10.0.1", | ||
"browserify": "^17.0.0", | ||
"conventional-changelog-conventionalcommits": "^4.6.1", | ||
"eslint": "^7.32.0", | ||
"lodash.constant": "3.0.0", | ||
"lodash.every": "4.6.0", | ||
"lodash.isfunction": "3.0.9", | ||
"lodash.map": "4.6.0", | ||
"lodash.some": "4.6.0", | ||
"lodash.uniq": "4.5.0", | ||
"nyc": "15.1.0", | ||
"lodash.constant": "^3.0.0", | ||
"lodash.every": "^4.6.0", | ||
"lodash.isfunction": "^3.0.9", | ||
"lodash.map": "^4.6.0", | ||
"lodash.some": "^4.6.0", | ||
"lodash.uniq": "^4.5.0", | ||
"nyc": "^15.1.0", | ||
"semantic-release": "^18.0.0", | ||
"tape-run": "9.0.0", | ||
"tape": "5.3.1" | ||
"tape-run": "^9.0.0", | ||
"tape": "^5.3.2" | ||
} | ||
} |
5552
16
74