Hi.

I've just created a small function to filter an array. Sort of the
reverse of each+without.

/*
Version 1.0.0 - Thursday, 23 August 2007 10:25 am
*/

Object.extend (
        Array.prototype, {
                /***************************************/
                /* Allow inline filtering of an array. */
                /***************************************/
                filter: function(f_Filter) {
                        var a_Return = [];
                        for (var i = 0, length = this.length; i < length; ++i)
                                if (f_Filter(this[i]))
                                        a_Return.push(this[i]);
                        return a_Return;
                }
        }
);

Usage :

a_Array.filter(function(item){return true/false;}).chain().chain();

With that 2 questions.

1 - Have I made any REALLY obvious mistakes.
2 - How do I submit this to the core?

Richard


-- 
-----
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731
"Standing on the shoulders of some very clever giants!"

--~--~---------~--~----~------------~-------~--~----~
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