Skip to content

Instantly share code, notes, and snippets.

@jamii
Created August 18, 2014 23:44
Show Gist options
  • Save jamii/5ae257b933465841b2cd to your computer and use it in GitHub Desktop.
Save jamii/5ae257b933465841b2cd to your computer and use it in GitHub Desktop.
function shrinkwrap(gen) {
return {
arbitrary: gen.arbitrary,
shrink: function(value) {
var shrinks = [];
for (var i = 0; i < maxShrinks; i++) {
try {
shrinks[i] = gen.randomShrink(value);
} catch (err) {
if (err.constructor !== Unshrinkable) throw err;
}
}
return shrinks;
},
show: gen.show,
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment