Skip to content

Instantly share code, notes, and snippets.

@jroehl
Created September 27, 2019 11:32
Show Gist options
  • Save jroehl/8b75e5358f0569e38cc30f99cb978959 to your computer and use it in GitHub Desktop.
Save jroehl/8b75e5358f0569e38cc30f99cb978959 to your computer and use it in GitHub Desktop.
Some useful regexes.

import to require

import (.*) from (.*)[;]?$
const $1 = require($2);

export to module.exports

export ((?:async )?(?:function)*(?:class)* ([a-zA-Z0-9]+)[ ]?\([\s\S]*?\n}\n)
$1

module.exports.$2 = $2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment