@travi/any
Advanced tools
Comparing version 1.4.4 to 1.5.0
@@ -67,4 +67,6 @@ # API Reference | ||
* `options`: object to provide configuration options | ||
* `size`: length of list that should be produced. defaults to a random number | ||
between `1` and `20`, if not provided. | ||
* `size`: length of list that should be produced | ||
* defaults to a random number between `1` and `20`, if not provided | ||
* the default range of potential sizes can be overridden by providing options | ||
for [integer](#integer) | ||
* `uniqueOn`: property on the produced objects that needs to be unique within | ||
@@ -243,1 +245,24 @@ the resulting list | ||
``` | ||
## `subset` | ||
An almost direct usage of [`pickset()` from chance.js](http://chancejs.com/#pickset). | ||
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'] | ||
``` |
@@ -258,2 +258,3 @@ 'use strict'; | ||
function word() { | ||
@@ -260,0 +261,0 @@ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
@@ -254,2 +254,3 @@ import Chance from 'chance'; | ||
function word() { | ||
@@ -256,0 +257,0 @@ var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; |
@@ -1,84 +0,1 @@ | ||
{ | ||
"name": "@travi/any", | ||
"version": "1.4.4", | ||
"description": "random data generator for when test data is insignificant", | ||
"main": "lib/any.cjs.js", | ||
"module": "lib/any.es.js", | ||
"scripts": { | ||
"clean": "rimraf coverage/ lib/", | ||
"build": "rollup -c", | ||
"lint:js": "eslint .", | ||
"lint:md": "globstar --node -- markdownlint *.md '**/*.md'", | ||
"tests:unit": "mocha --recursive test/unit/", | ||
"test": "run-s clean lint:* coverage", | ||
"coverage": "nyc run-s tests:unit", | ||
"report-coverage": "nyc report --reporter=text-lcov | coveralls", | ||
"preversion": "npm test", | ||
"prepublish": "npm run build", | ||
"precommit": "npm test", | ||
"commitmsg": "validate-commit-msg", | ||
"semantic-release": "semantic-release pre && npm publish && semantic-release post" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/travi/any.git" | ||
}, | ||
"keywords": [ | ||
"test", | ||
"random", | ||
"data", | ||
"chance" | ||
], | ||
"author": "Matt Travi <npm@travi.org> (https://matt.travi.org/)", | ||
"contributors": [ | ||
{ | ||
"name": "Trevor Richardson", | ||
"email": "tr@trevorrichardson.me", | ||
"url": "https://twitter.com/intelxdesign" | ||
} | ||
], | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/travi/any/issues" | ||
}, | ||
"homepage": "https://github.com/travi/any#readme", | ||
"dependencies": { | ||
"chance": "1.0.12", | ||
"debug": "3.1.0", | ||
"lodash": "4.17.4", | ||
"mersenne-twister": "1.1.0" | ||
}, | ||
"devDependencies": { | ||
"@travi/eslint-config-travi": "1.5.14", | ||
"babel-cli": "6.26.0", | ||
"babel-plugin-transform-exponentiation-operator": "6.24.1", | ||
"babel-preset-es2015-node": "6.1.1", | ||
"babel-preset-es2015-rollup": "3.0.0", | ||
"babel-preset-stage-3": "6.24.1", | ||
"babel-register": "6.26.0", | ||
"chai": "4.1.2", | ||
"coveralls": "3.0.0", | ||
"cz-conventional-changelog": "2.0.0", | ||
"formatio": "1.2.0", | ||
"globstar": "1.0.0", | ||
"husky": "0.14.3", | ||
"markdownlint-cli": "0.3.1", | ||
"mocha": "4.0.1", | ||
"npm-run-all": "4.1.1", | ||
"nyc": "11.2.1", | ||
"proxyquire": "1.8.0", | ||
"referee": "1.2.0", | ||
"referee-sinon": "1.0.3", | ||
"rimraf": "2.6.2", | ||
"rollup": "0.50.0", | ||
"rollup-plugin-babel": "3.0.2", | ||
"semantic-release": "7.0.2", | ||
"sinon": "3.2.1", | ||
"validate-commit-msg": "2.14.0" | ||
}, | ||
"config": { | ||
"commitizen": { | ||
"path": "./node_modules/cz-conventional-changelog" | ||
} | ||
} | ||
} | ||
{"name":"@travi/any","version":"1.5.0","description":"random data generator for when test data is insignificant","main":"lib/any.cjs.js","module":"lib/any.es.js","scripts":{"clean":"rimraf coverage/ lib/","build":"rollup -c","lint:js":"eslint .","lint:md":"globstar --node -- markdownlint *.md '**/*.md'","tests:unit":"mocha --recursive test/unit/","test":"run-s clean lint:* coverage","coverage":"nyc run-s tests:unit","report-coverage":"nyc report --reporter=text-lcov | coveralls","preversion":"npm test","prepublish":"npm run build","precommit":"npm test","commitmsg":"validate-commit-msg","semantic-release":"semantic-release pre && npm publish && semantic-release post","greenkeeper:update-lockfile":"greenkeeper-lockfile-update","greenkeeper:upload-lockfile":"greenkeeper-lockfile-upload"},"repository":{"type":"git","url":"https://github.com/travi/any.git"},"keywords":["test","random","data","chance"],"author":"Matt Travi <npm@travi.org> (https://matt.travi.org/)","contributors":[{"name":"Trevor Richardson","email":"tr@trevorrichardson.me","url":"https://twitter.com/intelxdesign"}],"license":"MIT","bugs":{"url":"https://github.com/travi/any/issues"},"homepage":"https://github.com/travi/any#readme","dependencies":{"chance":"1.0.12","debug":"3.1.0","lodash":"4.17.4","mersenne-twister":"1.1.0"},"devDependencies":{"@travi/eslint-config-travi":"1.5.19","babel-cli":"6.26.0","babel-plugin-transform-exponentiation-operator":"6.24.1","babel-preset-es2015-node":"6.1.1","babel-preset-es2015-rollup":"3.0.0","babel-preset-stage-3":"6.24.1","babel-register":"6.26.0","chai":"4.1.2","coveralls":"3.0.0","cz-conventional-changelog":"2.1.0","formatio":"1.2.0","globstar":"1.0.0","greenkeeper-lockfile":"1.12.0","husky":"0.14.3","markdownlint-cli":"0.3.1","mocha":"4.0.1","npm-run-all":"4.1.1","nyc":"11.2.1","proxyquire":"1.8.0","referee":"1.2.0","referee-sinon":"1.0.3","rimraf":"2.6.2","rollup":"0.50.0","rollup-plugin-babel":"3.0.2","semantic-release":"8.2.0","sinon":"4.0.2","validate-commit-msg":"2.14.0"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}}} |
@@ -5,3 +5,3 @@ /* eslint import/no-extraneous-dependencies: ["error", {"devDependencies": true}] */ | ||
export default { | ||
entry: 'src/index.js', | ||
input: 'src/index.js', | ||
plugins: [ | ||
@@ -18,6 +18,11 @@ babel({ | ||
], | ||
targets: [ | ||
{dest: 'lib/any.cjs.js', format: 'cjs'}, | ||
{dest: 'lib/any.es.js', format: 'es'} | ||
external: [ | ||
'chance', | ||
'mersenne-twister', | ||
'lodash' | ||
], | ||
output: [ | ||
{file: 'lib/any.cjs.js', format: 'cjs'}, | ||
{file: 'lib/any.es.js', format: 'es'} | ||
] | ||
}; |
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
26963
525
27
12