![]() ![]() N.expression.arguments?.declNode?.nodeId = arrRefId N?.expression?.callee?.type = 'FunctionExpression' & N. = arrRefIdīy using the optional chaining operator I can make assumptions that will coalesce all 6 conditions into 2. For example: const iifes = this._ast.filter(n => ![]() The examples you gave can definitely be improved. What I wonder is how much they are going to improve my code? The examples in the match-iz readme do look clearer with match and when. I grateful that you took the time to suggest it. Thanks for the suggestion and for introducing me to this interesting proposal. :) But maybe by plugging it a little I can help push along that process.Īnyway, just thought it might be of interest when dealing a lot with ASTs. Hope this isn't perceived too much like a plug for my actual library: I'd rather the proposal landed so I no longer need it. Match-iz is the main pattern-matching library, and byPattern comes from a small complement to it, sift-r. N.id?.references?.filter((r) => r.scope.scopeId > 0).lengthĬonst Used in another scope other than global. Here are a couple of your snippets I had a go at converting: There's a TC39 proposal that's in the works, but I got impatient and wrote a small lib that tries to provide the same functionality. I've done a little myself with eslint-plugins and codemods and found it useful for avoiding repetition and ?. Probably not a good idea for your current project, as adding a library would make performance worse and not better, but I just thought I'd plug pattern-matching if you're doing a lot of AST parsing. security code.ĭid I use $variable up there? Who knows. If you just program like mad and boobytrap your code with false comments and terrible design, nobody will even want to steal it. Well, as AI can program now I seen a meme of somebody doing some AJAX with it, and lo and behold, the AI randomly switches up styles, doesn't use comments and uses nonsense variable names. Their conclusion was "well, scientists made it", so they actually forked it, you can look this up. random style switches, nonsense variable names, no consistency, no comments. People in several communities complained about how obtuse the code was. I had a theory that maybe Open AI GPT-3 was created by an AI. There are hidden consequences for companies seeking obfuscation of their "product". The code is easily readable by someone that understands JavaScript, we do have a user object that is scoped within a function and there's a public object with methods in the window.Oh man, a cool guy I know a while back was tasked with maintenance on a super obfuscated code base (person had become arrested, the original developer, IIRC). So, if the code is readable as well, this person could steal your work and modify it at its will.Ĭonsider the following example of JavaScript ( example.js). So if the JavaScript code works without server interaction, someone could just download the HTML of your page, the resources (JS and CSS) and will obtain the same result locally. So if that person understands JavaScript, your source code is public now. Serving a JavaScript file without obfuscation, simply means that the code in the file will be readable by anyone. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |