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

@travi/any

Package Overview
Dependencies
Maintainers
1
Versions
91
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@travi/any - npm Package Compare versions

Comparing version 1.5.1 to 1.6.0

63

docs/API.md

@@ -26,3 +26,3 @@ # API Reference

produced object
* receives the current key as `key`
* receives the current key as the first argument and the index as the second
* defaults to [`string`](#string), if not provided

@@ -44,2 +44,63 @@

```js
any.objectWithKeys(['foo', 'bar', 'baz'], {factory: id => ({...any.simpleObject(), id})});
/*
{
foo: {
ipsawiw: '$McveM',
comgahra: ']TORpXOYqKQz&G]h',
ranimedo: 'Q^Y)ga2FG^jPzs](',
owabopmom: 'YQz[MoIEVHLbVG',
jebaru: 'qd&TpwaMEp8Vz#al8C',
zuwbedil: 'LC&c3$gPxI',
id: 'foo'
},
bar: {
jahaluz: '#HD0Zqs$QLxAC@Lrb*',
ekofesi: 'uhAOs',
veuhotuh: 'ob1K2TDc5Q',
zuufciw: 'L&hqNtx@',
riptutru: 'mYSXLZh#OmWvaJC2',
obebetmi: '[E@yC^xTBia*]kdvfC',
hugmoug: 'DfV8Qs9f8O433etJ',
zusurare: '0I0!xzrxEN$f4',
gonefo: 'YkLh9Sg&f7o%K)VDT',
watbihli: '3F2]ofS',
elaecave: 'iY@uTDWy@J',
id: 'bar'
},
baz: {
zehitek: '7$GlW8N',
upagpu: '9^UDxLQKp',
aniheiju: '9$lJPW6$eXhPf$GFa',
ekaradcun: ')nD1)rC&c^',
molilji: 'qvr7dW$Ve0uR3fkZ]',
jebowibuf: '0G6vTn)71NsXWsr]ypd',
wednotso: '2hHmqvDlw&&!^ycJ0',
arewibvuf: '*N^&UXo$c&eAiF^',
gutuet: '^JHXnzETi*VSuUy(3b',
molwadi: 'x!dAw',
fuglekpe: 'WqDOaU2[LdAvHm',
ireakiuso: '@VG9BF$)F',
id: 'baz'
}
}
*/
```
```js
const qux = ['a', 'b', 'c'];
any.objectWithKeys(['foo', 'bar', 'baz'], {factory: (id, index) => ({id, letter: qux[index]})});
/*
{
foo: { id: 'foo', letter: 'a' },
bar: { id: 'bar', letter: 'b' },
baz: { id: 'baz', letter: 'c' }
}
*/
```
## `fromList`

@@ -46,0 +107,0 @@

4

lib/any.cjs.js

@@ -191,4 +191,4 @@ 'use strict';

return keys.map(function (key) {
return options.factory ? [key, options.factory(key)] : [key, string()];
return keys.map(function (key, index) {
return options.factory ? [key, options.factory(key, index)] : [key, string()];
}).reduce(function (acc, _ref) {

@@ -195,0 +195,0 @@ var _ref2 = slicedToArray(_ref, 2),

@@ -187,4 +187,4 @@ import Chance from 'chance';

return keys.map(function (key) {
return options.factory ? [key, options.factory(key)] : [key, string()];
return keys.map(function (key, index) {
return options.factory ? [key, options.factory(key, index)] : [key, string()];
}).reduce(function (acc, _ref) {

@@ -191,0 +191,0 @@ var _ref2 = slicedToArray(_ref, 2),

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

{"name":"@travi/any","version":"1.5.1","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.5.0","mocha":"4.0.1","npm-run-all":"4.1.2","nyc":"11.3.0","proxyquire":"1.8.0","referee":"1.2.0","referee-sinon":"1.0.3","rimraf":"2.6.2","rollup":"0.51.8","rollup-plugin-babel":"3.0.2","semantic-release":"8.2.0","sinon":"4.1.2","validate-commit-msg":"2.14.0"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}}}
{"name":"@travi/any","version":"1.6.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.5.0","mocha":"4.0.1","npm-run-all":"4.1.2","nyc":"11.3.0","proxyquire":"1.8.0","referee":"1.2.0","referee-sinon":"1.0.3","rimraf":"2.6.2","rollup":"0.52.1","rollup-plugin-babel":"3.0.2","semantic-release":"8.2.0","sinon":"4.1.2","validate-commit-msg":"2.14.0"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}}}
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