Hi All,

Thanks for the input...

As Andrew puts it, I'm not sold on this either.

However, when I see the plethora of ways we currently test to see if a
variable is undefined:

    typeof example == 'undefined'
    example === undefined
    example == undefined (is that correct btw?)

I'm sure there's something we could do about this.

So there's another proposition I just though of, introducing the "is"
namespace:

    var is = {
      undefined: function(object) {
        return object === undefined;
      },

      defined: function(object) {
        return object !== undefined;
      },

      array: function(object) {
        return typeof object == 'object' && object.constructor ==
Array;
     },

     element: function(object) {
       return object.ownerDocument || object == window;
    }
     etc...
  }

Which could be used like this:

  if(is.array(example)) // do something

  example = is.undefined(example) ? null : example;

  example = is.defined(example) ? example : null;

Would this be a better idea?

Again, I'm just thinking out loud here, so any suggestions are
welcome.

Tobie






--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Prototype: Core" group.
To post to this group, send email to prototype-core@googlegroups.com
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