Hi all,

I find myself writing code like that the whole time:

    example = example === undefined ? null : example;

We could imagine the following utility function:

    $default = function(value, default) {
      return value === undefined ? default : value;
    }

So that the above could be shortened to:

    example = $default(example, null);

We could even decide to shorten it to $d:

    example = $d(example, null);

I'm not 100% sure I like it... so I'm submitting it here for
discussion before eventually posting a patch.

Regards,

Tobie


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/prototype-core?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to