Skip to content

Instantly share code, notes, and snippets.

@cjroth
Created February 23, 2014 22:54
Show Gist options
  • Save cjroth/9178540 to your computer and use it in GitHub Desktop.
Save cjroth/9178540 to your computer and use it in GitHub Desktop.
convert old style imports to new style with regex

converts old style imports:

var express            = require('express')
  , redismodule        = require('redis')
  , _                  = require('underscore')

to new style:

var express            = require('express');
var redismodule        = require('redis');
var _                  = require('underscore');

find: /(var| ,) (.*?)(?=\s) = ([^;\r\n]*);?/ replace: var \2 = \3;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment