Comparing version 2.0.1 to 3.0.0
@@ -10,13 +10,11 @@ /** | ||
``` | ||
import randomInt = require('random-int'); | ||
import randomInteger from 'random-int'; | ||
randomInt(5); | ||
randomInteger(5); | ||
//=> 3 | ||
randomInt(10, 100); | ||
randomInteger(10, 100); | ||
//=> 54 | ||
``` | ||
*/ | ||
declare function randomInt(minimum?: number, maximum?: number): number; | ||
export = randomInt; | ||
export default function randomInteger(minimum?: number, maximum?: number): number; |
@@ -1,4 +0,2 @@ | ||
'use strict'; | ||
module.exports = (minimum, maximum) => { | ||
export default function randomInteger(minimum, maximum) { | ||
if (maximum === undefined) { | ||
@@ -16,2 +14,2 @@ maximum = minimum; | ||
); | ||
}; | ||
} |
{ | ||
"name": "random-int", | ||
"version": "2.0.1", | ||
"version": "3.0.0", | ||
"description": "Generate a random integer", | ||
"license": "MIT", | ||
"repository": "sindresorhus/random-int", | ||
"funding": "https://github.com/sponsors/sindresorhus", | ||
"author": { | ||
"name": "Sindre Sorhus", | ||
"email": "sindresorhus@gmail.com", | ||
"url": "sindresorhus.com" | ||
"url": "https://sindresorhus.com" | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=8" | ||
"node": ">=12" | ||
}, | ||
@@ -23,3 +26,2 @@ "scripts": { | ||
"keywords": [ | ||
"rand", | ||
"random", | ||
@@ -37,8 +39,8 @@ "randomize", | ||
"devDependencies": { | ||
"ava": "^1.4.1", | ||
"in-range": "^2.0.0", | ||
"stable-fn": "^2.0.0", | ||
"tsd": "^0.7.2", | ||
"xo": "^0.24.0" | ||
"ava": "^3.15.0", | ||
"in-range": "^3.0.0", | ||
"stable-fn": "^3.0.0", | ||
"tsd": "^0.14.0", | ||
"xo": "^0.38.2" | ||
} | ||
} |
@@ -1,6 +0,5 @@ | ||
# random-int [![Build Status](https://travis-ci.org/sindresorhus/random-int.svg?branch=master)](https://travis-ci.org/sindresorhus/random-int) | ||
# random-int | ||
> Generate a random integer | ||
## Install | ||
@@ -12,23 +11,21 @@ | ||
## Usage | ||
```js | ||
const randomInt = require('random-int'); | ||
import randomInteger from 'random-int'; | ||
randomInt(5); | ||
randomInteger(5); | ||
//=> 3 | ||
randomInt(10, 100); | ||
randomInteger(10, 100); | ||
//=> 54 | ||
``` | ||
## API | ||
### randomInt([maximum]) | ||
### randomInteger(maximum?) | ||
Returns an integer from `0` to `maximum`. | ||
### randomInt(minimum, maximum) | ||
### randomInteger(minimum, maximum) | ||
@@ -39,3 +36,3 @@ Returns an integer from `minimum` to `maximum`. | ||
Type: `number`<br> | ||
Type: `number`\ | ||
Default: `0` | ||
@@ -47,3 +44,3 @@ | ||
Type: `number`<br> | ||
Type: `number`\ | ||
Default: `1` | ||
@@ -53,3 +50,2 @@ | ||
## Related | ||
@@ -64,6 +60,1 @@ | ||
- [crypto-random-string](https://github.com/sindresorhus/crypto-random-string) - Generate a cryptographically strong random string | ||
## License | ||
MIT © [Sindre Sorhus](https://sindresorhus.com) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Yes
3929
27
56