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 1.17.0 to 1.17.1

20

lib/chance-generators.js

@@ -84,7 +84,9 @@ /*global define*/

mapGenerator.shrink = function (value) {
if (value === lastMappedValue) {
return generator.shrink(lastValue).map(f)
} else {
return generator
if (generator.shrink) {
mapGenerator.shrink = function (value) {
if (value === lastMappedValue) {
return generator.shrink(lastValue).map(f)
} else {
return generator
}
}

@@ -333,11 +335,9 @@ }

that.identity = that.constant = generatorFunction('constant', [], function (data) {
var identityGenerator = generatorFunction('constant', [data], function () {
var constantGenerator = generatorFunction('constant', [data], function () {
return data
})
identityGenerator.map = function (fn) {
return that.constant(unwrap(fn(data)))
}
installMapFunction(constantGenerator)
return identityGenerator
return constantGenerator
})

@@ -344,0 +344,0 @@

{
"name": "chance-generators",
"version": "1.17.0",
"version": "1.17.1",
"description": "Random generators based on changejs",

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

@@ -271,4 +271,5 @@ /*global describe, it*/

const value = { foo: 'bar' }
const generator = chance.constant(value)
for (var i = 0; i < 5; i += 1) {
expect(chance.constant(value), 'when called', 'to be', value)
expect(generator, 'when called', 'to be', value)
}

@@ -280,2 +281,9 @@ })

})
it('supports the map method', () => {
const generator = chance.constant(42).map((value) => {
return chance.natural({ max: value })
})
expect(generator, 'when called', 'to be within', 0, 42)
})
})

@@ -282,0 +290,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