New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

fast-check

Package Overview
Dependencies
Maintainers
1
Versions
194
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fast-check - npm Package Compare versions

Comparing version 1.2.1 to 1.2.2

2

documentation/Arbitraries.md

@@ -64,3 +64,3 @@ # [:house:](../README.md) Arbitraries

- `fc.constant<T>(value: T): Arbitrary<T>` constant arbitrary only able to produce `value: T`
- `fc.constantFrom<T>(...values: T[]): Arbitrary<T>` randomly chooses among the values provided. It considers the first value as the default value so that in case of failure it will shrink to it
- `fc.constantFrom<T>(...values: T[]): Arbitrary<T>` randomly chooses among the values provided. It considers the first value as the default value so that in case of failure it will shrink to it. It expects a minimum of one value and throws whether it receives no value as parameters. It can easily be used on arrays with `fc.constantFrom(...myArray)` (or `fc.constantFrom.apply(null, myArray)` for older versions of TypeScript/JavaScript)
- `fc.oneof<T>(...arbs: Arbitrary<T>[]): Arbitrary<T>` randomly chooses an arbitrary at each new generation. Should be provided with at least one arbitrary. All arbitraries are equally probable and shrink is still working for the selected arbitrary. `fc.oneof` is able to shrink inside the failing arbitrary but not accross arbitraries (contrary to `fc.constantFrom` when dealing with constant arbitraries)

@@ -67,0 +67,0 @@ - `fc.option<T>(arb: Arbitrary<T>): Arbitrary<T | null>` or `fc.option<T>(arb: Arbitrary<T>, freq: number): Arbitrary<T | null>` arbitrary able to nullify its generated value. When provided a custom `freq` value it changes the frequency of `null` values so that they occur one time over `freq` tries (eg.: `freq=5` means that 20% of generated values will be `null` and 80% would be produced through `arb`). By default: `freq=5`

@@ -0,0 +0,0 @@ import Random from '../../random/generator/Random';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Arbitrary from './definition/Arbitrary';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Arbitrary from './definition/Arbitrary';

@@ -0,0 +0,0 @@ "use strict";

@@ -8,7 +8,9 @@ import Arbitrary from './definition/Arbitrary';

/**
* For one of `v0` or `...values` values - all equiprobable
* @param v0 One of the value to produce (all values shrink to this one)
* @param values Other possible values
* For one `...values` values - all equiprobable
*
* **WARNING**: It expects at least one value, otherwise it should throw
*
* @param values Constant values to be produced (all values shrink to the first one)
*/
declare function constantFrom<T>(v0: T, ...values: T[]): Arbitrary<T>;
declare function constantFrom<T>(...values: T[]): Arbitrary<T>;
export { constant, constantFrom };

@@ -101,14 +101,19 @@ "use strict";

/**
* For one of `v0` or `...values` values - all equiprobable
* @param v0 One of the value to produce (all values shrink to this one)
* @param values Other possible values
* For one `...values` values - all equiprobable
*
* **WARNING**: It expects at least one value, otherwise it should throw
*
* @param values Constant values to be produced (all values shrink to the first one)
*/
function constantFrom(v0) {
function constantFrom() {
var values = [];
for (var _i = 1; _i < arguments.length; _i++) {
values[_i - 1] = arguments[_i];
for (var _i = 0; _i < arguments.length; _i++) {
values[_i] = arguments[_i];
}
return new ConstantArbitrary(__spread([v0], values));
if (values.length === 0) {
throw new Error('fc.constantFrom expects at least one parameter');
}
return new ConstantArbitrary(__spread(values));
}
exports.constantFrom = constantFrom;
//# sourceMappingURL=ConstantArbitrary.js.map

@@ -0,0 +0,0 @@ import Random from '../../../random/generator/Random';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Random from '../../../random/generator/Random';

@@ -0,0 +0,0 @@ import Arbitrary from './Arbitrary';

@@ -0,0 +0,0 @@ import Stream from '../../../stream/Stream';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Arbitrary from './definition/Arbitrary';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Arbitrary from './definition/Arbitrary';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Arbitrary from './definition/Arbitrary';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { ArbitraryWithShrink } from './definition/ArbitraryWithShrink';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Arbitrary from './definition/Arbitrary';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Arbitrary from './definition/Arbitrary';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Arbitrary from './definition/Arbitrary';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Arbitrary } from './definition/Arbitrary';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Arbitrary from './definition/Arbitrary';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { Arbitrary } from './definition/Arbitrary';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Arbitrary from './definition/Arbitrary';

@@ -0,0 +0,0 @@ "use strict";

import { tuple } from './TupleArbitrary.generated';
import { genericTuple } from './TupleArbitrary.generic';
export { tuple, genericTuple };

@@ -0,0 +0,0 @@ import Arbitrary from './definition/Arbitrary';

@@ -0,0 +0,0 @@ import Random from '../../random/generator/Random';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

import { asyncProperty } from './AsyncProperty.generated';
import { AsyncProperty } from './AsyncProperty.generic';
export { asyncProperty, AsyncProperty };

@@ -0,0 +0,0 @@ import Arbitrary from '../arbitrary/definition/Arbitrary';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Random from '../../random/generator/Random';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Random from '../../random/generator/Random';

@@ -0,0 +0,0 @@ "use strict";

import { property } from './Property.generated';
import { Property } from './Property.generic';
export { property, Property };

@@ -0,0 +0,0 @@ import Arbitrary from '../arbitrary/definition/Arbitrary';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Random from '../../random/generator/Random';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Random from '../../random/generator/Random';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Random from '../../random/generator/Random';

@@ -0,0 +0,0 @@ "use strict";

"use strict";
exports.__esModule = true;
//# sourceMappingURL=Parameters.js.map

@@ -0,0 +0,0 @@ import { Parameters } from './Parameters';

"use strict";
exports.__esModule = true;
//# sourceMappingURL=RunDetails.js.map

@@ -0,0 +0,0 @@ import { RunDetails } from './RunDetails';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { AsyncProperty } from '../property/AsyncProperty';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Arbitrary from '../arbitrary/definition/Arbitrary';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import Shrinkable from '../arbitrary/definition/Shrinkable';

@@ -0,0 +0,0 @@ "use strict";

import Shrinkable from '../../arbitrary/definition/Shrinkable';
/** @hidden */
export declare function pathWalk<Ts>(path: string, initialValues: IterableIterator<Shrinkable<Ts>>): IterableIterator<Shrinkable<Ts>>;

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import { RunDetails } from '../reporter/RunDetails';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import 'core-js';

@@ -0,0 +0,0 @@ "use strict";

import * as fc from './fast-check-default';
export default fc;
export * from './fast-check-default';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ import * as prand from 'pure-rand';

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ export default class Stream<T> implements IterableIterator<T> {

@@ -0,0 +0,0 @@ "use strict";

{
"name": "fast-check",
"version": "1.2.1",
"version": "1.2.2",
"description": "Property based testing framework in TypeScript (like QuickCheck)",

@@ -5,0 +5,0 @@ "main": "lib/fast-check.js",

@@ -34,10 +34,15 @@ import Random from '../../random/generator/Random';

/**
* For one of `v0` or `...values` values - all equiprobable
* @param v0 One of the value to produce (all values shrink to this one)
* @param values Other possible values
* For one `...values` values - all equiprobable
*
* **WARNING**: It expects at least one value, otherwise it should throw
*
* @param values Constant values to be produced (all values shrink to the first one)
*/
function constantFrom<T>(v0: T, ...values: T[]): Arbitrary<T> {
return new ConstantArbitrary<T>([v0, ...values]);
function constantFrom<T>(...values: T[]): Arbitrary<T> {
if (values.length === 0) {
throw new Error('fc.constantFrom expects at least one parameter');
}
return new ConstantArbitrary<T>([...values]);
}
export { constant, constantFrom };

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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