I couldn't find any adequate-seeming email address validators, so I decided to write my own. This should be useful in Node.js and the browser. However, it's my first time doing such a thing, so I'd like to get some reviewage, if anyone doesn't mind. Cheers! http://dpaste.org/urMoa/
closed as not a real question by Corbin, Glenn Rogers, palacsint, Brian Reichle, Jeff Vanzella Nov 26 '12 at 3:25
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, see the FAQ.
Some thoughts, they're not all going to be gold:
It seems you're trying to export only a single function, which is why you use those inner functions instead of having them be stand-alone. If performance is not an issue, then this is totally fine, but if this is going to be run a lot on a server, then you might want to think about bringing those regex objects outside of the function and declaring them somewhere where they won't get recompiled each call. For client code, not a big deal though.
All in all, the code looks pretty clean though. I didn't really look it over for correctness though, but this can and should be part of a trivial unit test.
|show 1 more comment|