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 3.0.1 to 3.1.0

lib/Producer.js

5

lib/GeneratorIterator.js

@@ -25,2 +25,3 @@ "use strict";

this.seed = seed == null ? Math.round(Math.random() * 10000) : seed;
this.context = {};
if (skipSeedCache) {

@@ -38,2 +39,3 @@ this.chance = new Chance(seed);

this.generator = this.generator.shrink(value);
this.context = {};
this.isShrinkable = Boolean(this.generator.shrink);

@@ -47,2 +49,3 @@ }

this.generator = this.generator.expand(value);
this.context = {};
this.isExpandable = Boolean(this.generator.expand);

@@ -63,3 +66,3 @@ }

value: function next() {
return this.generator.generate(this.chance);
return this.generator.generate(this.chance, this.context);
}

@@ -66,0 +69,0 @@ }]);

18

lib/index.js

@@ -9,2 +9,3 @@ "use strict";

var FloatingGenerator = require("./FloatingGenerator");
var Generator = require("./Generator");
var IntegerGenerator = require("./IntegerGenerator");

@@ -18,2 +19,3 @@ var MagicFloatingGenerator = require("./MagicFloatingGenerator");

var PicksetGenerator = require("./PicksetGenerator");
var Producer = require("./Producer");
var SequenceGenerator = require("./SequenceGenerator");

@@ -95,3 +97,3 @@ var ShapeGenerator = require("./ShapeGenerator");

text: createGeneratorFacade(TextGenerator),
unique: function unique() {
producer: function producer() {
for (var _len9 = arguments.length, args = Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {

@@ -101,5 +103,5 @@ args[_key9] = arguments[_key9];

return new (Function.prototype.bind.apply(UniqueGenerator, [null].concat(args)))();
return new (Function.prototype.bind.apply(Producer, [null].concat(args)))();
},
weighted: function weighted() {
unique: function unique() {
for (var _len10 = arguments.length, args = Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {

@@ -109,4 +111,12 @@ args[_key10] = arguments[_key10];

return new (Function.prototype.bind.apply(UniqueGenerator, [null].concat(args)))();
},
weighted: function weighted() {
for (var _len11 = arguments.length, args = Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
args[_key11] = arguments[_key11];
}
return new (Function.prototype.bind.apply(WeightedGenerator, [null].concat(args)))();
}
},
Generator: Generator
};

@@ -113,0 +123,0 @@

@@ -23,3 +23,3 @@ "use strict";

return magicValuesSet && Array.from(magicValuesSet) || [];
return magicValuesSet && (Array.isArray(magicValuesSet) ? [].concat(magicValuesSet) : Array.from(magicValuesSet)) || [];
};

@@ -26,0 +26,0 @@

@@ -6,3 +6,3 @@ {

"license": "MIT",
"version": "3.0.1",
"version": "3.1.0",
"main": "lib/index.js",

@@ -9,0 +9,0 @@ "files": [

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