# Generator Transformation

Advanced tutorial

The contents of this document should be considered advanced and is provided mostly for interest. You do not need to understand this document in order to use quick_check.js to its full potential.

## qc.map â¸¬ (a â†’ b) â†’ Gen a â†’ Gen b

This allows you to define a generator in terms of another generator. This function is curried.

## qc.of â¸¬ a â†’ Gen a

Creates a generator based on a constant value. This generator returns the constant value passed into it. In effect, it works like Lodash's `_.constant`

function.

```
expect(function(a) {
return a === 5;
}).forAll(qc.of(3));
```

```
expect (a) ->
a == 5
.forAll qc.of 3
```

```
expect(a => a === 5).forAll(qc.of(3));
```

## qc.join â¸¬ Gen (Gen a) â†’ Gen a

Takes a generator generator and returns a generator. This way you can unwrap unnecessarily complex values.

Updated about 6 years ago