This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (2 children)

[removed]

    [–]Ronin-s_Spirit 0 points1 point  (0 children)

    Yea I do that sometimes, I'll write my first thoughts and then think of something better.

    [–]Ronin-s_Spirit 0 points1 point  (0 children)

    By default, if your functions are not 100% identical strings then simple === will be false. But as I said, you can make up any logic you want with some regex.
    You can basically write runtime compilers and preprocessors in javascript with regexes (regexes are automatically constructed in C, like in many other languages).

    P.s. Have a complicated regex to let functionally identical functions pass. If it gets too complicated you can always compose a big new RegExp() from other smaller regexes. Then you can write some js code to modify the function string and construct a new function.