Hacker News new | past | comments | ask | show | jobs | submit login

I did have a look at tern. It looks very interesting. But it couldn't rename the field with this code:

    var key = "test";
    var theThing = {};
    theThing[key] = function() { return "hello"; };;
    console.log(theThing.test());

Which isn't so exotic.

To clarify, if I had a string in my source code that had nothing to do with looking up attributes, it wouldn't be touched?

    var one = "_I_just_like_talking_like_this_";
    var two = "_two";
    var test = {};
    test[two] = "II";
    console.log(test._two);
The result would be

    var one = "_I_just_like_talking_like_this_";
    var two = "two";
    var test = {};
    test[two] = "II";
    console.log(test.two);


?



If you had this:

    var one = "_I_just_like_talking_like_this_";
    var two = "_two";
    var test = {_two: "II"};
And ran the program in the blog post, one's value, two's value and the _two attribute in test would match.

If you removed the string stanza in the post, only the _two attribute in test would match.


Sorry I made a mistake didn't make the point I was trying to make, updated post.




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: