1 | "use strict";
|
2 |
|
3 | var assert = require("assert");
|
4 |
|
5 | var arbitraryBless = require("./arbitraryBless.js");
|
6 | var generator = require("./generator.js");
|
7 | var show = require("./show.js");
|
8 | var shrink = require("./shrink.js");
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 | function bless(arb) {
|
30 | assert(arb !== null && typeof arb === "object", "bless: arb should be an object");
|
31 | assert(typeof arb.generator === "function", "bless: arb.generator should be a function");
|
32 |
|
33 |
|
34 | if (typeof arb.shrink !== "function") {
|
35 | arb.shrink = shrink.noop;
|
36 | }
|
37 |
|
38 |
|
39 | if (typeof arb.show !== "function") {
|
40 | arb.show = show.def;
|
41 | }
|
42 |
|
43 | generator.bless(arb.generator);
|
44 | shrink.bless(arb.shrink);
|
45 |
|
46 | arbitraryBless(arb);
|
47 | return arb;
|
48 | }
|
49 |
|
50 | module.exports = bless;
|