array-shuffle
Advanced tools
Comparing version 2.0.0 to 3.0.0
@@ -8,3 +8,3 @@ /** | ||
``` | ||
import arrayShuffle = require('array-shuffle'); | ||
import arrayShuffle from 'array-shuffle'; | ||
@@ -15,4 +15,2 @@ const shuffled = arrayShuffle([1, 2, 3, 4, 5, 6]); | ||
*/ | ||
declare function arrayShuffle<ElementType>(array: readonly ElementType[]): ElementType[]; | ||
export = arrayShuffle; | ||
export default function arrayShuffle<ElementType>(array: readonly ElementType[]): ElementType[]; |
@@ -1,4 +0,2 @@ | ||
'use strict'; | ||
module.exports = array => { | ||
export default function arrayShuffle(array) { | ||
if (!Array.isArray(array)) { | ||
@@ -16,2 +14,2 @@ throw new TypeError(`Expected an array, got ${typeof array}`); | ||
return array; | ||
}; | ||
} |
{ | ||
"name": "array-shuffle", | ||
"version": "2.0.0", | ||
"version": "3.0.0", | ||
"description": "Randomize the order of items in an array", | ||
@@ -13,4 +13,6 @@ "license": "MIT", | ||
}, | ||
"type": "module", | ||
"exports": "./index.js", | ||
"engines": { | ||
"node": ">=10" | ||
"node": ">=12.20" | ||
}, | ||
@@ -36,6 +38,6 @@ "scripts": { | ||
"devDependencies": { | ||
"ava": "^3.13.0", | ||
"tsd": "^0.13.1", | ||
"xo": "^0.35.0" | ||
"ava": "^3.15.0", | ||
"tsd": "^0.17.0", | ||
"xo": "^0.42.0" | ||
} | ||
} |
@@ -5,3 +5,3 @@ # array-shuffle | ||
Uses the [Durstenfeld algorithm](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm) based on the [Fisher–Yates algorithm](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle). | ||
Uses the [Durstenfeld algorithm](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#The_modern_algorithm) which is based on the [Fisher–Yates algorithm](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle). | ||
@@ -17,2 +17,4 @@ ## Install | ||
```js | ||
import arrayShuffle from 'array-shuffle'; | ||
const shuffled = arrayShuffle([1, 2, 3, 4, 5, 6]); | ||
@@ -28,4 +30,4 @@ //=> [3, 5, 4, 1, 2, 6] | ||
Type: `array` | ||
Type: `Array` | ||
The array to shuffle. |
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
3098
31
Yes
22