We have an isArray method in the latest nightlies (jQuery.isArray) but
unless we have a need for it in core we're not likely to add a method
like isEmpty.
This would make for a perfectly acceptable plugin, though - thanks for
the suggestion!
--John
On Sat, Nov 29, 2008 at 10:18 AM, William Chang <[EMAIL PROTECTED]> wrote:
>
> I would like to make a request (or proposal) to be included in the
> next version of jQuery: isEmpty() method to return true or false for
> condition statements. I'm not sure jQuery have something like this,
> but let me know if it exist or does not exist? Thanks!
>
> By the way, this is for jQuery Utilities: Object/Test Operation
>
> Here is my code I use to do isEmpty in JavaScript. Someone can make it
> better please for jQuery:
>
> // Is empty.
> function isEmpty(mixed_var) {return (mixed_var == undefined ||
> mixed_var === '' || mixed_var === 0 || mixed_var === '0' || mixed_var
> === null || mixed_var === false || (isArray(mixed_var) &&
> mixed_var.length === 0));}
> // Is array.
> function isArray(mixed_var) {return (mixed_var instanceof Array);}
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" 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/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---