Comparing version 1.9.2 to 1.10.0
@@ -6,3 +6,5 @@ "use strict"; | ||
* @packageDocumentation | ||
* ![NPM Downloads](https://img.shields.io/npm/d18m/smath) Small math function library | ||
* Small math function library | ||
* | ||
* ![NPM Downloads](https://img.shields.io/npm/d18m/smath) | ||
*/ | ||
@@ -408,2 +410,3 @@ /** | ||
* ``` | ||
* @deprecated Use `SMath.shuffle()` instead | ||
*/ | ||
@@ -422,2 +425,19 @@ function rseq(min, max) { | ||
/** | ||
* Randomize an array of arbitrary elements. | ||
* @param stack An array of arbitrary elements | ||
* @returns The `stack` array in a random order | ||
* @example | ||
* ```js | ||
* ``` | ||
*/ | ||
function shuffle(stack) { | ||
var rawData = []; | ||
for (var _i = 0, stack_1 = stack; _i < stack_1.length; _i++) { | ||
var item = stack_1[_i]; | ||
rawData.push({ index: Math.random(), value: item }); | ||
} | ||
return rawData.sort(function (a, b) { return a.index - b.index; }).map(function (a) { return a.value; }); | ||
} | ||
SMath.shuffle = shuffle; | ||
/** | ||
* Take the limit of a function. A return value of `NaN` indicates | ||
@@ -424,0 +444,0 @@ * that no limit exists either due to a discontinuity or imaginary value. |
{ | ||
"name": "smath", | ||
"version": "1.9.2", | ||
"version": "1.10.0", | ||
"description": "Small math function library", | ||
@@ -5,0 +5,0 @@ "homepage": "https://npm.nicfv.com/", |
/** | ||
* @packageDocumentation | ||
* ![NPM Downloads](https://img.shields.io/npm/d18m/smath) Small math function library | ||
* Small math function library | ||
* | ||
* ![NPM Downloads](https://img.shields.io/npm/d18m/smath) | ||
*/ | ||
@@ -273,5 +275,15 @@ /** | ||
* ``` | ||
* @deprecated Use `SMath.shuffle()` instead | ||
*/ | ||
function rseq(min: number, max: number): Array<number>; | ||
/** | ||
* Randomize an array of arbitrary elements. | ||
* @param stack An array of arbitrary elements | ||
* @returns The `stack` array in a random order | ||
* @example | ||
* ```js | ||
* ``` | ||
*/ | ||
function shuffle<T>(stack: Array<T>): Array<T>; | ||
/** | ||
* Take the limit of a function. A return value of `NaN` indicates | ||
@@ -278,0 +290,0 @@ * that no limit exists either due to a discontinuity or imaginary value. |
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
35717
1022