ES5 support
Closed this issue · 5 comments
I am a big fan of fantasy-land. Today I come across an issue when trying to use fantasy-land laws to test my reference implementation of Identity type. My tests run under node 4, 5, 6, 7. The codebase of fantasy-land will run only for node of version => 6. When I want to use the laws on node 4 or 5 I got syntax error due to the fact that there are places where object destructuring are used. And destructuring is only supported on node => 6.
I propose to create a prepublishOnly entry in package.json, and use babel to transpile the sourcecode into valid ES5 code. That way even older nodes can benefit from fantasy-land. Before publising to npm, ES5 tranpiled version of code will be created in ./lib directory and 'main' entry in package.json will point to this dir. Take a look here what I have in mind.
I can create a PR with all described above, I just need a green light to do so.
Thank you
@davidchambers you're planning to rewrite the code to ES5 or use babel to do the translation for us ?
I'll just revert 2da88d5. ;)
Hi @davidchambers, just a quick question. Am I assuming correctly that these laws will replace the one in fantasy-land/laws ? If so, do we have some time estimates when can this happen ? thank you
Am I assuming correctly that these laws will replace the one in fantasy-land/laws ?
Yes, that's right.
If so, do we have some time estimates when can this happen ?
I won't make any promises, but I can say that #1 is now blocking several Sanctuary-related pull requests so I have a strong incentive to complete the remaining tasks. :)
👍 Super
Current work-around for this (if using babel) is to exclude fantasy-land from ignores:
POC: https://github.com/char0n/ramda-adjunct/blob/master/test/mocha-bootstrap.js