@travi/any
Advanced tools
Comparing version 1.9.1 to 2.0.0
@@ -345,24 +345,1 @@ # API Reference | ||
``` | ||
## `subset` | ||
An almost direct usage of [`pickset()` from chance.js](http://chancejs.com/helpers/pickset.html). | ||
The `size` option is passed directly to the chance method's `quantity` argument | ||
so refer to its documentation for what is available. | ||
### `subset` parameters | ||
* `list` (required): list of items the subset will be taken from | ||
* `options`: object to provide configuration options | ||
* `size`: size of the subset to attempt to generate from the given list | ||
* if the value is larger than the size of the list, the subset will | ||
be the entire list. | ||
* defaults to `2` if not provided | ||
### `subset` example | ||
```js | ||
any.subset(['one', 'two', 'three', 'four'], 2); | ||
// ['two', 'four'] | ||
``` |
@@ -66,5 +66,2 @@ 'use strict'; | ||
}); | ||
const subset = (list, { | ||
size = 2 | ||
} = {}) => chance.pickset(list, size); | ||
const fromList = list => chance.pickone(list); | ||
@@ -139,4 +136,3 @@ const subList = (list, { | ||
fromList, | ||
subList, | ||
subset | ||
subList | ||
}; | ||
@@ -143,0 +139,0 @@ |
@@ -62,5 +62,2 @@ import Chance from 'chance'; | ||
}); | ||
const subset = (list, { | ||
size = 2 | ||
} = {}) => chance.pickset(list, size); | ||
const fromList = list => chance.pickone(list); | ||
@@ -135,4 +132,3 @@ const subList = (list, { | ||
fromList, | ||
subList, | ||
subset | ||
subList | ||
}; | ||
@@ -139,0 +135,0 @@ |
{ | ||
"name": "@travi/any", | ||
"version": "1.9.1", | ||
"version": "2.0.0", | ||
"description": "random data generator for when test data is insignificant", | ||
@@ -5,0 +5,0 @@ "main": "lib/any.cjs.js", |
Sorry, the diff of this file is not supported yet
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
38214
253