module.exports = function({ types: t }) {
class State {
constructor(count, name) {
this.count = count;
this.name = name;
}
}
function is_hook_name(name) {
return (name.startsWith("use") && (name.length > 3));
}
let state = {};
return {
visitor: {
Identifier(path) {
const node = path.node;
const name = node.name;
if ((name === "foo")) {
path.replaceWith({ name: "bar" });
}
}
}
};
};