0.0.0 • Published 2 years ago

eme v0.0.0

Weekly downloads
2
License
ISC
Repository
-
Last release
2 years ago

eme

Use the magic of AST to figure out variables to inject/return when extracting a method.

const {
  sameScope, // destination scope is the same, you should skip injecting vars because they are all in scope anyways
  isExpression, // if it's an expression then you should simply return the expression from the function
  variablesToInject, // variables that need to be injected in the extracted function
  variablesToReturn // variables that the donor scope has references to
} = eme({

  // selection range relative to 'file'
  location: {
    start: { line: 2, col: 0 },
    end: { line: 4, col: 80 },
  },

  // full contents of buffer/file
  file: `
    const { writeFile } = require('fs')

    const text = 'hello world'
    writeFile('hello.txt', text, 'utf8')
  `,

  // destination line where to extract method to
  destination: 3
})
0.0.0

2 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago