Skip to content

Instantly share code, notes, and snippets.

@tmcw
Created August 12, 2016 19:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tmcw/24b1049f367697295accdecd3d413ad5 to your computer and use it in GitHub Desktop.
Save tmcw/24b1049f367697295accdecd3d413ad5 to your computer and use it in GitHub Desktop.
var fs = require('fs');
var path = require('path');
// var utilPath = path.join(path.relative(
// path.dirname(process.argv[2]),
// path.join(__dirname, './js/lib')), 'd3.combobox.js');
// convert old-fashioned d3 event dispatching with new-fashioned
fs.writeFileSync(process.argv[2],
fs.readFileSync(process.argv[2], 'utf8').replace(/\sevent\.(\w+)\((.*)?\)/g, function(res, p1, p2) {
if (p2) return ' event.call("' + p1 + '", ' + p2 + ')';
return ' event.call("' + p1 + '")';
}));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment