CutPasteAssign Package


#1

In Visual Studio there is a plugin to easily convert this:

if(Object.getArray(names[4]).length==5){
    document.write(Object.getArray(names[4])[4]);
}

into:

var gotArray=Object.getArray(names[4])
if(gotArray.length==5){
    document.write(gotArray[4]);
}

What it does: it cuts the repeated bit and pastes it into a new variable assigned above the code, I find this slow and cumbersome to do so was wondering if anyone would be interested in a package for it.
implementation: I sort of have an idea how to do this but would have to learn the API for it so if there is already something that would be ideal.

Would there be some sort of demand for this or would it just be making it for me?


#2

I’m sure that others would be interested in using something like that if it existed.


#3

Seems like something maybe cut out for Tern.


http://ternjs.net/