Skip to content

Instantly share code, notes, and snippets.

@tmcw
Last active March 31, 2016 15:15
Show Gist options
  • Save tmcw/402de01c0b9c7851402303461e013e0e to your computer and use it in GitHub Desktop.
Save tmcw/402de01c0b9c7851402303461e013e0e to your computer and use it in GitHub Desktop.
module.exports = function (file, api) {
const j = api.jscodeshift;
return j(file.source)
.find(j.NewExpression)
.filter(p => p.value.callee && p.value.callee.name === 'Object')
.replaceWith(p => p.value.arguments[0])
.toSource();
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment