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.16.0 to 1.17.0

6

documentation/index.md

@@ -91,3 +91,3 @@ ---

### identity
### constant

@@ -97,5 +97,5 @@ Always generates the given value.

```js
let { identity } = new Generators(42)
let { constant } = new Generators(42)
let constantNumberGenerator = identity(42)
let constantNumberGenerator = constant(42)

@@ -102,0 +102,0 @@ expect(constantNumberGenerator, 'when called', 'to equal', 42)

@@ -143,3 +143,3 @@ /*global define*/

} else {
return that.identity(data)
return that.constant(data)
}

@@ -153,3 +153,3 @@

if (data.length === 0) {
return that.identity(data)
return that.constant(data)
}

@@ -179,7 +179,7 @@

pickone: function (generator, data) {
return that.identity(data)
return that.constant(data)
},
pickset: function (generator, data) {
if (data.length === 0) {
return that.identity(data)
return that.constant(data)
}

@@ -209,3 +209,3 @@

if (!shrinkable) {
return that.identity(data)
return that.constant(data)
}

@@ -248,3 +248,3 @@

} else {
return that.identity(data)
return that.constant(data)
}

@@ -263,3 +263,3 @@ },

if (data.length === 0) {
return that.identity(data)
return that.constant(data)
} else if (typeof limits.length === 'undefined') {

@@ -270,3 +270,3 @@ limits.length = that.integer({ min: 0, max: data.length })

} else {
return that.identity(data)
return that.constant(data)
}

@@ -316,3 +316,3 @@

g.shrink = function (data) {
return that.identity(data)
return that.constant(data)
}

@@ -339,4 +339,4 @@ }

that.identity = generatorFunction('identity', [], function (data) {
var identityGenerator = generatorFunction('identity', [data], function () {
that.identity = that.constant = generatorFunction('constant', [], function (data) {
var identityGenerator = generatorFunction('constant', [data], function () {
return data

@@ -346,3 +346,3 @@ })

identityGenerator.map = function (fn) {
return that.identity(unwrap(fn(data)))
return that.constant(unwrap(fn(data)))
}

@@ -349,0 +349,0 @@

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

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

@@ -262,2 +262,21 @@ /*global describe, it*/

describe('constant', () => {
it('generate the given value', () => {
expect(chance.constant({ foo: 'bar' }), 'when called', 'to equal', {
foo: 'bar'
})
})
it('always generates the given value', () => {
const value = { foo: 'bar' }
for (var i = 0; i < 5; i += 1) {
expect(chance.constant(value), 'when called', 'to be', value)
}
})
it('does not unwrap generators', () => {
expect(chance.constant(chance.integer), 'when called', 'to be a function')
})
})
describe('identity', () => {

@@ -264,0 +283,0 @@ it('generate the given value', () => {

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