On 22 August 2011 17:57, Angus Croll wrote:
> Nick, more power to you for experimenting with eval. Blanket rejection of
> "bad practices" makes the language go stale. Understanding the risks and
> using a feature judiciously is a better approach (I'm sure there was a time
> when folks shook their
On 22 August 2011 08:11, Lasse Reichstein wrote:
>
> If I read it correctly, you first check if the input contains any
> non-word-character, and if so, throw an exception.
> If you didn't throw, you then remove all non-word-characters - but you just
> checked that there wasn't any, so the replace
On Sun, Aug 21, 2011 at 8:23 PM, Nick Morgan wrote:
> That was an incomplete refactoring! I did have two regex literals,
> then I assigned the first to `invalidIdentifier`, but forgot to
> replace the second regex literal with `invalidIdentifier` :/
>
> But yes, you're right, I could've just done
On 21 August 2011 18:30, Danilo Celic wrote:
> Nick,
>
> I think that you can get away with only using the RegExp once (especially
> since the code you sent set the RegExp into a variable, uses that once, and
> then you use another RegExp literal in your return statement):
That was an incomplete
t; To: jsmentors@googlegroups.com
> Subject: [JSMentors] Accessing private vars in the revealing module
pattern
>
> Hi guys
>
> Thought I'd share a little toy I just made, to see what you thought:
>
> http://jsfiddle.net/skilldrick/EjHWT/1/
>
> var obj = (func
On 21 August 2011 00:56, Christian C. Salvadó wrote:
>
> I agree with Peter, I'd expose only things I really want to. Personally, I
> always try to avoid `eval`, IMHO avoiding `eval` is not just about the risks
> of code evaluation, `eval` inhibits a lot of optimizations, for example, in
> your co
On Sat, Aug 20, 2011 at 1:22 PM, Nick Morgan wrote:
> On 20 August 2011 20:10, Peter van der Zee wrote:
>
> > Personally I'd never use a construct like this. Just expose private
> > variables as you go. Using eval is dangerous, especially because I
> > don't quite see the point of the regex. I m
On 20 August 2011 20:10, Peter van der Zee wrote:
> Personally I'd never use a construct like this. Just expose private
> variables as you go. Using eval is dangerous, especially because I
> don't quite see the point of the regex. I mean, what is clean() trying
> to do? `alert('foo');` is going t
On Sat, Aug 20, 2011 at 8:22 PM, Nick Morgan wrote:
> Hi guys
>
> Thought I'd share a little toy I just made, to see what you thought:
>
...
> It gives you access to the value of private vars via a safe eval.
> Thought it might come in useful for testing occasionally. I'm not
> suggesting using it
Hi guys
Thought I'd share a little toy I just made, to see what you thought:
http://jsfiddle.net/skilldrick/EjHWT/1/
var obj = (function () {
var private = 5;
var private2 = 10;
function clean(varName) {
var invalidIdentifier = /[^\w]+/g;
if (varName.match(invalidIde
10 matches
Mail list logo