Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose stringify in the API #348

Merged
merged 1 commit into from May 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/fast-check-default.ts
Expand Up @@ -74,6 +74,7 @@ import { ExecutionStatus } from './check/runner/reporter/ExecutionStatus';
import { ExecutionTree } from './check/runner/reporter/ExecutionTree';
import { cloneMethod } from './check/symbols';
import { Stream, stream } from './stream/Stream';
import { stringify } from './utils/stringify';

// boolean
// floating point types
Expand Down Expand Up @@ -170,6 +171,8 @@ export {
Arbitrary,
Shrinkable,
cloneMethod,
// print values
stringify,
// interfaces
Context,
ExecutionStatus,
Expand Down
5 changes: 4 additions & 1 deletion src/utils/stringify.ts
Expand Up @@ -61,7 +61,10 @@ export function stringifyInternal<Ts>(value: Ts, previousValues: any[]): string
}
}

/** @hidden */
/**
* Convert any value to its fast-check string representation
* @param value Value to be converted into a string
*/
export function stringify<Ts>(value: Ts): string {
return stringifyInternal(value, []);
}