Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

unique-random

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

unique-random - npm Package Compare versions

Comparing version 2.1.0 to 3.0.0

9

index.d.ts

@@ -8,3 +8,3 @@ /**

```
import uniqueRandom = require('unique-random');
import uniqueRandom from 'unique-random';

@@ -17,7 +17,2 @@ const random = uniqueRandom(1, 10);

*/
declare function uniqueRandom(
minimum: number,
maximum: number
): () => number;
export = uniqueRandom;
export default function uniqueRandom(minimum: number, maximum: number): () => number;

@@ -1,5 +0,4 @@

'use strict';
export default function uniqueRandom(minimum, maximum) {
let previousValue;
module.exports = (minimum, maximum) => {
let previousValue;
return function random() {

@@ -9,5 +8,7 @@ const number = Math.floor(

);
previousValue = number === previousValue && minimum !== maximum ? random() : number;
return previousValue;
};
};
}
{
"name": "unique-random",
"version": "2.1.0",
"version": "3.0.0",
"description": "Generate random numbers that are consecutively unique",
"license": "MIT",
"repository": "sindresorhus/unique-random",
"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": ">=6"
"node": ">=12"
},

@@ -32,6 +35,6 @@ "scripts": {

"devDependencies": {
"ava": "^1.4.1",
"tsd": "^0.7.2",
"xo": "^0.24.0"
"ava": "^3.15.0",
"tsd": "^0.14.0",
"xo": "^0.38.2"
}
}

@@ -1,2 +0,2 @@

# unique-random [![Build Status](https://travis-ci.org/sindresorhus/unique-random.svg?branch=master)](https://travis-ci.org/sindresorhus/unique-random)
# unique-random

@@ -7,3 +7,2 @@ > Generate random numbers that are consecutively unique

## Install

@@ -15,7 +14,6 @@

## Usage
```js
const uniqueRandom = require('unique-random');
import uniqueRandom from 'unique-random';

@@ -28,3 +26,2 @@ const random = uniqueRandom(1, 10);

## API

@@ -36,3 +33,2 @@

## Related

@@ -48,6 +44,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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc