Skip to content
This repository has been archived by the owner on Jan 2, 2024. It is now read-only.

Commit

Permalink
docs: fix readme quick start bug
Browse files Browse the repository at this point in the history
  • Loading branch information
holvonixAdvay authored Aug 5, 2019
1 parent 1849e5f commit 1496897
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,21 @@ After `yarn add io-ts io-ts-fuzzer`...
import * as t from 'io-ts';
import * as fuzz from 'io-ts-fuzzer';

function fuzz() {
// Fuzzers for common types
const r = fuzz.createCoreRegistry();

// Type to fuzz
const target = t.union([t.string, t.type({n:t.number, b:t.boolean})]);

// Builds a particular fuzzer from the registry.
const fuzzer = fuzz.exampleGenerator(r, target);

// Make examples. The input number fully determines
// the output example.
console.log(fuzzer.encode(0));
console.log(fuzzer.encode(1));
console.log(fuzzer.encode(2));
console.log(fuzzer.encode(493));
}
// Fuzzers for common types
const r = fuzz.createCoreRegistry();

// Type to fuzz
const target = t.union([t.string, t.type({n:t.number, b:t.boolean})]);

// Builds a particular fuzzer from the registry.
const fuzzer = fuzz.exampleGenerator(r, target);

// Make examples. The input number fully determines
// the output example.
console.log(fuzzer.encode(0));
console.log(fuzzer.encode(1));
console.log(fuzzer.encode(2));
console.log(fuzzer.encode(493));
````

## Types Supported
Expand Down

0 comments on commit 1496897

Please sign in to comment.