Last active
December 30, 2015 11:35
-
-
Save burtyish/11fb6ee7ef0302132af4 to your computer and use it in GitHub Desktop.
Some useful regexs for migrating cjsx files to ES6
This file contains hidden or 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
// require -> import | |
([\w{},]+)[\s]?=[\s]?require[\s]?[(]?['"]([\w\/.-]+)['"][)]? | |
import $1 from '$2'; | |
// module.exports -> export default | |
module.exports[\s]?=[\s]?([\w]+) | |
export default $1; | |
// @ -> this. | |
@ | |
this. | |
// function declarations | |
:[\s]?(\(([\w,\s={}]*)\))?\s*-> | |
($1) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment