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

chance-generators

Package Overview
Dependencies
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chance-generators - npm Package Compare versions

Comparing version 2.1.1 to 2.1.2

11

lib/chance-generators.js

@@ -216,2 +216,6 @@ /*global define*/

unique: function (generator, data) {
if (data.length === 0) {
return that.constant(data)
}
var count = generator.args[1]

@@ -225,7 +229,4 @@ if (count && count.shrink) {

var dataGenerator = generator.args[0]
if (dataGenerator.shrink) {
return that.pickset(data.map(dataGenerator.shrink), count)
} else {
return that.pickset(data, count)
}
return that.unique(dataGenerator, count)
},

@@ -232,0 +233,0 @@ shape: function (generator, data) {

{
"name": "chance-generators",
"version": "2.1.1",
"version": "2.1.2",
"description": "Random generators based on changejs",

@@ -5,0 +5,0 @@ "main": "lib/chance-generators.js",

@@ -302,2 +302,14 @@ /*global describe, it*/

})
describe('shrink', () => {
it('returns a new generator generating smaller unique sets', () => {
let generator = chance.unique(chance.state, chance.natural({ max: 10 }))
while (generator.shrink) {
generator = generator.shrink(generator())
}
expect(generator, 'when called', 'to be empty')
})
})
})

@@ -304,0 +316,0 @@

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