Created
July 2, 2020 18:04
-
-
Save dubzzz/90eca0f675f0ea054ad16aec907219b7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const map = (g, mapper, unmapper) => { | |
return { | |
generate(mrng) { | |
return mapper(g.generate(mrng)); | |
}, | |
*shrink(value) { | |
for (const shrunkValue of g.shrink(unmapper(value))) { | |
yield mapper(shrunkValue); | |
} | |
} | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment