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

testcheck

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

testcheck - npm Package Compare versions

Comparing version 0.1.4 to 1.0.0-rc.0

dist/testcheck.js.flow

823

dist/testcheck.d.ts

@@ -1,419 +0,564 @@

declare module 'testcheck' {
/**
* Options to be passed to array() or object()
*/
interface SizeOptions {
/**
* If provided, the exact size of the resulting collection.
*/
size?: number,
/**
* Optional arguments to `check` and `sample`.
* If provided, the minimum size of the resulting collection.
*/
export interface Options {
minSize?: number,
// Number of times to run `check` or `sample`.
times?: number;
/**
* If provided, the maximum size of the resulting collection.
*/
maxSize?: number,
}
// The maximum "size" to provide to sized generators. Default: 200
maxSize?: number;
/**
* Generators of values.
*/
export class Generator<T> {
// The seed to use for the random number generator. Default: Random
seed?: number;
}
/**
* The result of running `check`.
* Creates a new Generator which also sometimes generates null values.
*/
export interface Result {
nullable(): Generator<T | null>;
// True of the check passed.
result: boolean;
// The number of generated checks ran.
'num-tests': number;
// The seed used for this check.
seed?: number;
// The arguments generated when and if this check failed.
fail?: Array<any>;
// The size used when and if this check failed
'failing-size'?: number;
/**
* When a check fails, the failing arguments shrink to find the smallest
* value that fails.
*/
shrunk?: {
// True if the check passed, otherwise false.
result: boolean;
// The smallest arguments with this result.
smallest: Array<any>;
// The depth of the shrunk result.
depth: number;
// The number of nodes shrunk to result in this smallest failing value.
'total-nodes-visited': number;
}
}
/**
* Generators of values.
* Creates a new Generator which generates non-empty values.
*
* Generator is an opaque type. It has no public methods or properties.
* Examples of empty values are 0, "", null, [], and {}
*/
export interface Generator<T> {}
notEmpty(): Generator<T>;
/**
* Given a property to check, return the result of the check.
* Creates a new Generator which ensures that all values generated adhere to
* the given predicate function.
*
* A "property" is a Generator of booleans which should always generate true.
* If the property generates a false value, check will shrink the generator
* and return a Result which includes the `shrunk` key.
* For example, to create a Generator of any number except multiples of 5:
*
* If no options are provided, they default to:
* var genAnythingBut5s = gen.int.suchThat(n => n % 5 !== 0);
*
* {times: 100, maxSize: 200, seed: <Random>}
*
* Note: Care is needed to ensure there is a high chance the predicate will
* pass, after ten attempts, an exception will throw.
*/
export function check(property: Generator<boolean>, options?: Options): Result;
suchThat(fn: (value: T) => boolean): Generator<T>;
/**
* Creates a "property" as needed by `check`.
* Creates a new Generator that depends on the values of this Generator.
*
* Accepts an array of value generators, the results of which become the
* arguments of the property function. The property function should return
* true if the property is upheld, or false if it fails.
* For example, to create a Generator of square numbers:
*
* var numGoUp = property([gen.int, gen.posInt], (a, b) => a + b > a);
* check(numGoUp, {times: 1000});
* var genSquares = gen.int.then(n => n * n);
*
* For example, to create a Generator which first generates an array of
* integers, and then returns both that array and a sampled value from it:
*
* var genList = gen.notEmpty(gen.array(gen.int))
* var genListAndItem = genList.then(
* list => [ list, gen.oneOf(list) ]
* );
*
*/
export function property(
argGens: Array<Generator<any>>,
propertyFn: (...args: any[]) => boolean
): Generator<boolean>;
then<U>(fn: (value: T) => Generator<U> | U): Generator<U>;
/**
* Handy tool for checking the output of your generators. Given a generator,
* it returns an array of the results of the generator.
* Creates a new Generator which grows at a different scale.
*
* var results = sample(gen.int, { seed: 123 });
* // [ 0, 1, 1, 2, 3, 3, -6, 1, -3, -8 ]
* Generators start by producing very "small" values (closer to 0) at first,
* and produce larger values in later iterations of a test as a result of a
* "size" value which grows with each generation. Typically "size" grows
* linearly, but .scale() can alter a size to grow at different rates.
*
* If no options are provided, they default to:
* For example, to generate "big" numbers that grow super-linearly (cubicly):
*
* {times: 10, maxSize: 200, seed: <Random>}
* var bigInts = gen.int.scale(n => n * n * n)
* console.log(sample(bigInts))
* // [ 0, 1, 5, 0, -59, -56, -160, 261, 409, -34 ]
*
* Note: When shrinking a failing test, "size" gets smaller. If the scale
* function returns a value that's not dependent on it's input, then the
* resulting Generator will not shrink.
*/
export function sample<T>(gen: Generator<T>, options?: Options): Array<T>;
scale(fn: (size: number) => number): Generator<T>;
/**
* Creates a new Generator which will never shrink.
* This is useful when shrinking is taking a long time or is not applicable.
*/
neverShrink(): Generator<T>;
// Generator Builders
// ------------------
/**
* Creates a new Generator which will always consider shrinking, even if the
* property passes (up to one additional level).
*/
alwaysShrink(): Generator<T>;
}
export var gen: {
/**
* Creates a new Generator which ensures that all values Generated adhere to
* the given `predicate`.
*
* Care is needed to ensure there is a high chance the predicate will pass.
* By default, `suchThat` will try 10 times to generate a satisfactory
* value. If no value adheres to the predicate, an exception will throw. You
* can pass an optional third argument to change the number of times tried.
* Note that each retry will increase the size of the generator.
*/
suchThat: <T>(
predicate: (value: T) => boolean,
generator: Generator<T>,
maxTries?: number // default 10
) => Generator<T>;
/**
* Properties created by property()
*/
export interface Property<TArgs> {}
/**
* Creates a new Generator of collections (Arrays or Objects) which are
* not empty.
*/
notEmpty: <T>(
generator: Generator<T>,
maxTries?: number
) => Generator<T>;
/**
* The options accepted by check()
*/
export interface CheckOptions {
/**
* Creates a new Generator which is the mapped result of another generator.
*
* var genSquares = gen.map(n => n * n, gen.posInt);
*
*/
map: <T, S>(
mapper: (value: T) => S,
generator: Generator<T>
) => Generator<S>;
// Number of times to run `check`.
numTests?: number,
/**
* Creates a new Generator which passes the result of `generator` into the
* `binder` function which should return a new Generator. This allows you to
* create new Generators that depend on the values of other Generators.
* For example, to create a Generator which first generates an array of
* integers, and then chooses a random element from that array:
*
* gen.bind(gen.notEmpty(gen.array(gen.int))), gen.returnOneOf)
*
*/
bind: <T, S>(
generator: Generator<T>,
binder: (value: T) => Generator<S>
) => Generator<S>;
// The maximum "size" to provide to sized generators. Default: 200
maxSize?: number,
/**
* Creates a Generator that relies on a size. Size allows for the "shrinking"
* of Generators. Larger "size" should result in a larger generated value.
*
* For example, `gen.int` is shrinkable because it is implemented as:
*
* var gen.int = gen.sized(size => gen.intWithin(-size, size))
*
*/
sized: <T>(sizedGenFn: (size: number) => Generator<T>) => Generator<T>;
// The seed to use for the random number generator. Default: Random
seed?: number,
}
/**
* Given an explicit size, and a Generator that relies on size, returns a new
* Generator which always uses the provided size and is not shrinkable.
*/
resized: <T>(size: number, generator: Generator<T>) => Generator<T>;
/**
* Given a property to check, return the result of the check.
*
* If the property generates a false value, check will shrink the generator
* and return a Result which includes the `shrunk` key.
*
* If no options are provided, they default to:
*
* {numTests: 100, maxSize: 200, seed: <Random>}
*
*/
export function check<TArgs>(property: Property<TArgs>, options?: CheckOptions): {
/**
* Given a shrinkable Generator, return a new Generator which will never
* shrink. This can be useful when shrinking is taking a long time or is not
* applicable to the domain.
*/
noShrink: <T>(generator: Generator<T>) => Generator<T>;
// True if the check passed, otherwise false or a thrown Error.
result: boolean | Error,
/**
* Given a shrinkable Generator, return a new Generator which will always
* consider shrinking, even if the property passes (up to one
* additional level).
*/
shrink: <T>(generator: Generator<T>) => Generator<T>;
// The number of generated checks ran.
numTests: number,
// The seed used for this check.
seed?: number,
// Simple Generators
// -----------------
// The arguments generated when and if this check failed.
fail?: TArgs,
/**
* Creates a Generator which will always generate the provided value.
*
* var alwaysThree = gen.return(3);
*
*/
return: <T>(value: T) => Generator<T>;
// The size used when and if this check failed
failingSize?: number,
/**
* Creates a Generator which will always generate one of the provided values.
*
* var alphabetSoup = gen.returnOneOf(['a', 'b', 'c']);
*
*/
returnOneOf: <T>(values: T[]) => Generator<T>;
/**
* When a check fails, the failing arguments shrink to find the smallest
* value that fails.
*/
shrunk?: {
// True if the check passed, otherwise false or a thrown Error.
result: boolean | Error,
/**
* Creates a Generator which will generate values from one of the
* provided generators.
*
* var numOrBool = gen.oneOf([gen.int, gen.boolean])
*
*/
oneOf: <T>(generators: Generator<T>[]) => Generator<T>;
// The smallest arguments with this result.
smallest: TArgs,
/**
* Similar to `oneOf`, except provides probablistic "weights" to
* each generator.
*
* var numOrRarelyBool = gen.oneOf([[99, gen.int], [1, gen.boolean]])
*/
oneOfWeighted: <T>(
generators: Array</*number, Generator<T>*/any>[]
) => Generator<T>;
// The depth of the shrunk result.
depth: number,
/**
* Given a function which takes a generator and returns a generator (such as
* `gen.array` or `gen.object`), and a Generator to use as values, creates
* potentially nested values.
*
* gen.nested(gen.array, gen.int)
* // [ [ 0, [ -2 ], 1, [] ]
*
*/
nested: <C, T>(
collectionGenFn: (valueGen: Generator<T>) => Generator<C>,
valueGen: Generator<T>
) => Generator<C>;
// The number of nodes shrunk to result in this smallest failing value.
totalNodesVisited: number,
}
};
// Collections: Arrays and Objects
// -------------------------------
/**
* Creates a "property" as needed by `check`.
*
* Accepts any number of value generators, the results of which become the
* arguments of the property function. The property function should return
* true if the property is upheld, or false if it fails.
*
* var numGoUp = property(gen.int, gen.posInt, (a, b) => a + b > a);
* check(numGoUp, {times: 1000});
*
*/
export function property<A>(
genA: Generator<A>,
f: (a: A) => boolean | void
): Property<[A]>;
export function property<A,B>(
genA: Generator<A>,
genB: Generator<B>,
f: (a: A, b: B) => boolean | void
): Property<[A, B]>;
export function property<A,B,C>(
genA: Generator<A>,
genB: Generator<B>,
genC: Generator<C>,
f: (a: A, b: B, c: C) => boolean | void
): Property<[A, B, C]>;
export function property<A,B,C,D>(
genA: Generator<A>,
genB: Generator<B>,
genC: Generator<C>,
genD: Generator<D>,
f: (a: A, b: B, c: C, d: D) => boolean | void
): Property<[A, B, C, D]>;
export function property<A,B,C,D,E>(
genA: Generator<A>,
genB: Generator<B>,
genC: Generator<C>,
genD: Generator<D>,
genE: Generator<E>,
f: (a: A, b: B, c: C, d: D, e: E) => boolean | void
): Property<[A, B, C, D, E]>;
/**
* Generates Arrays of values. There are a few forms `gen.array` can be used:
*
* - Generate Arrays of random lengths (ex. arrays of integers)
*
* gen.array(gen.int)
*
* - Generate Arrays of specific lengths (ex. length of 5)
*
* gen.array(gen.int, 5)
*
* - Generate Arrays of random lengths within a specific range
* (ex. between 2 and 10)
*
* gen.array(gen.int, 2, 10)
*
* - Generate Arrays of specific lengths with different kinds of values at
* each index (e.g. tuples). (ex. tuples of [int, bool] like `[3, true]`)
*
* gen.array([ gen.int, gen.boolean ])
*
*/
array: {
<T>(valueGen: Generator<T>): Generator<Array<T>>;
<T>(valueGen: Generator<T>, length: number): Generator<Array<T>>;
<T>(valueGen: Generator<T>, min: number, max: number): Generator<Array<T>>;
(genTuple: Array<Generator<any>>): Generator<Array<any>>;
}
/**
* Handy tool for checking the output of your generators. Given a generator,
* it returns an array of the results of the generator.
*
* var results = sample(gen.int);
* // [ 0, 1, 1, 2, 3, 3, -6, 1, -3, -8 ]
*
* By default 10 samples are provided unless otherwise specified.
*
*/
export function sample<T>(gen: Generator<T>, numValues?: number): Array<T>;
/**
* Generates Objects of values. There are a few forms `gen.object` can be used:
*
* - Generate Objects with random keys (alpha-numeric keys, up to 16 chars)
*
* gen.object(gen.int)
*
* - Generate Objects with a specified kind of key and value,
* (ex. numeric keys)
*
* gen.object(gen.int, gen.int)
*
* - Generate Objects with specific keys with different kinds of values at
* each key (e.g. records). (ex. a 2d point like `{ x: 3, y: 5 }`)
*
* gen.object({ x: gen.posInt, y: gen.posInt })
*
*/
object: {
<T>(valueGen: Generator<T>): Generator<{[key: string]: T}>;
<T>(keyGen: Generator<string>, valueGen: Generator<T>): Generator<{[key: string]: T}>;
(genMap: {[key: string]: Generator<any>}): Generator<{[key: string]: any}>;
}
/**
* Handy tool for visualizing the output of your Generator.
*
* Given a Generator, it returns a single value generated for a given `size`.
*
* sampleOne(gen.int)
* // 24
*
* By default, values of size 30 are produced.
*/
export function sampleOne<T>(gen: Generator<T>, size?: number): T;
/**
* Generates either an Array or an Object with values of the provided kind.
*/
arrayOrObject: <T>(
valueGen: Generator<T>
) => Generator<{[key: string]: T; [key: number]: T}>;
// JS Primitives
// -------------
// Generator Builders
// ------------------
NaN: Generator<number>;
undefined: Generator<void>;
null: Generator<void>;
boolean: Generator<boolean>;
export const gen: {
/**
* A sized, shrinkable generator producing integers.
*/
int: Generator<number>;
// JS Primitives
// -------------
/**
* Only positive integers (0 through +Inf)
*/
posInt: Generator<number>;
/**
* Generates any JS value, including Arrays and Objects (possibly nested).
*/
any: Generator<any>;
/**
* Only negative integers (0 through -Inf)
*/
negInt: Generator<number>;
/**
* Generates any primitive JS value:
* strings, numbers, booleans, null, undefined, or NaN.
*/
primitive: Generator<any>;
/**
* Only strictly positive integers (1 through +Inf)
*/
strictPosInt: Generator<number>;
boolean: Generator<boolean>;
null: Generator<void>;
undefined: Generator<void>;
NaN: Generator<number>;
/**
* Only strictly negative integers (1 through -Inf)
*/
strictNegInt: Generator<number>;
// Numbers
// -------
/**
* Generates an integer within the provided (inclusive) range.
* The resulting Generator is not shrinkable.
*/
intWithin: (min: number, max: number) => Generator<number>;
/**
* Generates floating point numbers (including +Infinity, -Infinity, and NaN).
*/
number: Generator<number>;
/**
* Generates ascii characters (code 0 through 255).
*/
char: Generator<string>;
/**
* Generates only positive numbers (0 though +Infinity), does not generate NaN.
*/
posNumber: Generator<number>;
/**
* Generates printable ascii characters (code 32 through 126).
*/
asciiChar: Generator<string>;
/**
* Generates only negative numbers (0 though -Infinity), does not generate NaN.
*/
negNumber: Generator<number>;
/**
* Generates ascii characters matching /a-zA-Z0-9/
*/
alphaNumChar: Generator<string>;
/**
* Generates a floating point number within the provided (inclusive) range.
* Does not generate NaN or +-Infinity.
*/
numberWithin: (min: number, max: number) => Generator<number>;
/**
* Generates strings. Note: strings of arbitrary characters may result in
* Unicode characters and non-printable characters.
*/
string: Generator<string>;
/**
* Generator integers (32-bit signed) including negative numbers and 0.
*/
int: Generator<number>;
/**
* Generates strings of printable Ascii characters.
*/
asciiString: Generator<string>;
/**
* Generates positive integers, including 0.
*/
posInt: Generator<number>;
/**
* Generates strings of [a-zA-Z0-9]*
*/
alphaNumString: Generator<string>;
/**
* Generates negative integers, including 0.
*/
negInt: Generator<number>;
/**
* Generates only strictly positive integers, not including 0.
*/
sPosInt: Generator<number>;
// JSON
/**
* Generates only strictly negative integers, not including 0.
*/
sNegInt: Generator<number>;
/**
* Generates JSON primitives: strings, numbers, booleans and null.
*/
JSONPrimitive: Generator<any>;
/**
* Generates an integer within the provided (inclusive) range.
* The resulting Generator is not shrinkable.
*/
intWithin: (min: number, max: number) => Generator<number>;
/**
* Generates JSON values: primitives, or (possibly nested) arrays or objects.
*/
JSONValue: Generator<any>;
/**
* Generates JSON objects where each key is a JSON value.
*/
JSON: Generator<{[key: string]: any}>;
// Strings
// -------
/**
* Generates strings of arbitrary characters.
*
* Note: strings of arbitrary characters may result in higher-plane Unicode
* characters and non-printable characters.
*/
string: Generator<string>;
// JS
// --
/**
* Generates strings of printable ascii characters.
*/
asciiString: Generator<string>;
/**
* Generates any primitive JS value:
* strings, numbers, booleans, null, undefined, or NaN.
*/
primitive: Generator<any>;
/**
* Generates strings of only alpha-numeric characters: a-z, A-Z, 0-9.
*/
alphaNumString: Generator<string>;
/**
* Generates any JS value (possibly nested).
*/
any: Generator<any>;
/**
* Generates substrings of an original string (including the empty string).
*/
substring: (original: string) => Generator<string>;
}
/**
* Generates arbitrary 1-byte characters (code 0 through 255).
*/
char: Generator<string>;
/**
* Generates only printable ascii characters (code 32 through 126).
*/
asciiChar: Generator<string>;
/**
* Generates only alpha-numeric characters: a-z, A-Z, 0-9.
*/
alphaNumChar: Generator<string>;
// Collections: Arrays and Objects
// -------------------------------
/**
* Generates Arrays of values. There are a few forms `gen.array` can be used:
*
* - Generate Arrays of random sizes (ex. arrays of integers)
*
* gen.array(gen.int)
*
* - Generate Arrays of specific sizes (ex. length of 5)
*
* gen.array(gen.int, { size: 5 })
*
* - Generate Arrays of random sizes within a specific range
* (ex. between 2 and 10)
*
* gen.array(gen.int, { minSize: 2, maxSize: 10 })
*
*/
array: <T>(valueGen: Generator<T>, options?: SizeOptions) => Generator<Array<T>>;
/**
* Generates Arrays of unique values.
*
* Accepts the same size options as gen.array()
*
* Optionally also accepts a function to determine how to determine if a value
* is unique. For example, if 2d points are the same:
*
* var genPoint = gen.shape([ gen.int, gen.int ])
* var genUniquePoints = gen.uniqueArray(genPoint, point => point.join())
*
*/
uniqueArray: {
<T>(valueGen: Generator<T>, options?: SizeOptions): Generator<Array<T>>;
<T>(valueGen: Generator<T>, uniqueBy: (value: T) => any, options?: SizeOptions): Generator<Array<T>>;
};
/**
* Generates Objects of values. There are a few forms `gen.object` can be used:
*
* - Generate Objects with a specified kind of value and alpha-numeric keys.
*
* gen.object(gen.int)
*
* - Generate Objects with a specified kind of key and value,
* (ex. numeric keys)
*
* gen.object(gen.int, gen.int)
*
*/
object: {
<T>(valueGen: Generator<T>, options?: SizeOptions): Generator<{[key: string]: T}>;
<T>(keyGen: Generator<string>, valueGen: Generator<T>, options?: SizeOptions): Generator<{[key: string]: T}>;
};
/**
* Generates either an Array or an Object with values of the provided kind.
*
* Note: Objects will be produced with alpha-numeric keys.
*/
arrayOrObject: <T>(
valueGen: Generator<T>
) => Generator<{[key: string]: T; [key: number]: T}>;
/**
* Given a function which takes a generator and returns a generator (such as
* `gen.array` or `gen.object`), and a Generator to use as values, creates
* potentially nested values.
*
* gen.nested(gen.array, gen.int)
* // [ [ 0, [ -2 ], 1, [] ]
*
*/
nested: <C, T>(
collectionGenFn: (valueGen: Generator<T>) => Generator<C>,
valueGen: Generator<T>
) => Generator<C>;
/**
* Generates a specific shape of values given an initial nested Array or Object which
* contain *Generators*. Any values within the provided shape which don't contain
* generators will be *cloned* (with `gen.clone()`).
*
* Note: Whenever a non-*Generator* is provided to a function which expects a *Generator*,
* it is converted to a *Generator* with `gen.shape()`. That makes calling this function
* optional for most cases, unless trying to be explicit.
*
* There are a few forms `gen()` can be used:
*
* - Generate an Array shape with different values at each index (also known as "tuples")
*
* For example, a tuples of [ "constant", *int*, *bool* ] like `['foo', 3, true]`:
*
* ```js
* gen.shape([ 'foo', gen.int, gen.boolean ])
* ```
*
* - Generate an Object shape with different values for each key (also known as "records")
*
* For example, a record of { x: "constant", y: *int*, z: *bool* } like `{ x: 'foo', y: -4, z: false }`:
*
* ```js
* gen.shape({ x: 'foo', y: gen.int, z: gen.boolean })
* ```
*
* - Combinations of Array and Object shapes with generators at any point:
*
* For example, a data shape for a complex "place" data shape might look like:
*
* ```js
* gen.shape({
* type: 'Place',
* name: gen.string,
* location: [ gen.number, gen.number ],
* address: {
* street: gen.string,
* city: gen.string
* }
* })
* ```
*/
shape: {
// Note: this only models one layer deep shapes, not recursive shapes, and does not model records.
<T1, T2, T3, T4, T5>(tupleGens: [T1 | Generator<T1>, T2 | Generator<T2>, T3 | Generator<T3>, T4 | Generator<T4>, T5 | Generator<T5>]): Generator<[T1, T2, T3, T4, T5]>;
<T1, T2, T3, T4>(tupleGens: [T1 | Generator<T1>, T2 | Generator<T2>, T3 | Generator<T3>, T4 | Generator<T4>]): Generator<[T1, T2, T3, T4]>;
<T1, T2, T3>(tupleGens: [T1 | Generator<T1>, T2 | Generator<T2>, T3 | Generator<T3>]): Generator<[T1, T2, T3]>;
<T1, T2>(tupleGens: [T1 | Generator<T1>, T2 | Generator<T2>]): Generator<[T1, T2]>;
<T1>(tupleGens: [T1 | Generator<T1>]): Generator<[T1]>;
(genMap: {[key: string]: Generator<any>}): Generator<{[key: string]: any}>;
};
// JSON
// ----
/**
* Generates JSON objects where each key is a JSON value.
*/
JSON: Generator<{[key: string]: any}>;
/**
* Generates JSON values: primitives, or (possibly nested) arrays or objects.
*/
JSONValue: Generator<any>;
/**
* Generates JSON primitives: strings, numbers, booleans and null.
*/
JSONPrimitive: Generator<any>;
// Generator Creators
// ------------------
/**
* Creates a Generator which will generate values from one of the
* provided generators.
*
* var numOrBool = gen.oneOf([gen.int, gen.boolean])
*
*/
oneOf: <T>(generators: Array<Generator<T> | T>) => Generator<T>;
/**
* Similar to `gen.oneOf()`, except provides probablistic "weights" to
* each generator.
*
* var numOrRarelyBool = gen.oneOfWeighted([[99, gen.int], [1, gen.boolean]])
*/
oneOfWeighted: <T>(
generators: Array<[ number, Generator<T> | T ]>
) => Generator<T>;
/**
* Creates a Generator which will always generate clones of the provided value.
*
* var threeThings = gen.clone([1,2,3]);
*
*/
clone: <T>(value: T) => Generator<T>;
/**
* Creates a Generator which will always generate references of the provided value.
*
* var alwaysBlue = gen.return('blue');
*
*/
return: <T>(value: T) => Generator<T>;
/**
* Creates a Generator that relies on a size. Size allows for the "shrinking"
* of Generators. Larger "size" should result in a larger generated value.
*
* For example, `gen.int` is shrinkable because it is implemented as:
*
* var gen.int = gen.sized(size => gen.intWithin(-size, size))
*
*/
sized: <T>(sizedGenFn: (size: number) => Generator<T> | T) => Generator<T>;
}
{
"name": "testcheck",
"version": "0.1.4",
"version": "1.0.0-rc.0",
"description": "Property testing for JavaScript",
"homepage": "https://github.com/leebyron/testcheck-js",
"homepage": "http://leebyron.com/testcheck-js",
"license": "BSD-3-Clause",
"author": {

@@ -18,8 +19,8 @@ "name": "Lee Byron",

"main": "dist/testcheck.js",
"types": "dist/testcheck.d.ts",
"devDependencies": {
"jasmine-node": "^1.14.5"
"flow-bin": "^0.37.3",
"jasmine-node": "^1.14.5",
"typescript": "^2.1.4"
},
"engines": {
"node": ">=0.8.0"
},
"files": [

@@ -40,6 +41,11 @@ "dist",

"scripts": {
"test": "jasmine-node spec/",
"build": "./resources/build.sh"
"test": "npm run rebuild && npm run testonly && npm run flow-check && npm run ts-check",
"testonly": "jasmine-node test",
"flow-check": "flow check test",
"ts-check": "DIFF=$(tsc --noEmit --noImplicitAny --strictNullChecks test/types.ts | diff test/types.ts.expected -); if [ -n \"$DIFF\" ]; then echo \"$DIFF\"; exit 1; fi;",
"ts-check-update": "tsc --noEmit --noImplicitAny --strictNullChecks test/types.ts > test/types.ts.expected; exit 0",
"build": "rm -f dist/* && lein do clean, cljsbuild once && cp type-definitions/* dist/",
"rebuild": "lein do cljsbuild once && cp type-definitions/* dist/"
},
"license": "BSD"
}
"dependencies": {}
}

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