Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

consider giving MutatorPlugins some state for statistics and profiling. #11

Open
bttmly opened this issue Oct 25, 2018 · 0 comments
Open

Comments

@bttmly
Copy link
Owner

bttmly commented Oct 25, 2018

// current:
const plugin: MutatorPlugin = {
  type: "mutator",
  name: "tweak-arguments",
  nodeTypes: [S.CallExpression],
  filter: util.lengthAtPropGreaterThan("arguments", 0),
  mutator: util.dropEachOfProp("arguments"),
};
// next:
export default new MutatorPlugin({
  name: "tweak-arguments",
  nodeTypes: [S.CallExpression],
  filter: util.lengthAtPropGreaterThan("arguments", 0),
  mutator: util.dropEachOfProp("arguments"),
})

what this allows is the mutator to carry some state around and do things like track how many times each gets called, how expensive its mutations are, etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant