@@ 744-758 (lines=15) @@ | ||
741 | return first; |
|
742 | }, |
|
743 | ||
744 | grep: function( elems, callback, inv ) { |
|
745 | var ret = [], retVal; |
|
746 | inv = !!inv; |
|
747 | ||
748 | // Go through the array, only saving the items |
|
749 | // that pass the validator function |
|
750 | for ( var i = 0, length = elems.length; i < length; i++ ) { |
|
751 | retVal = !!callback( elems[ i ], i ); |
|
752 | if ( inv !== retVal ) { |
|
753 | ret.push( elems[ i ] ); |
|
754 | } |
|
755 | } |
|
756 | ||
757 | return ret; |
|
758 | }, |
|
759 | ||
760 | // arg is for internal usage only |
|
761 | map: function( elems, callback, arg ) { |
@@ 718-732 (lines=15) @@ | ||
715 | return first; |
|
716 | }, |
|
717 | ||
718 | grep: function( elems, callback, inv ) { |
|
719 | var ret = [], retVal; |
|
720 | inv = !!inv; |
|
721 | ||
722 | // Go through the array, only saving the items |
|
723 | // that pass the validator function |
|
724 | for ( var i = 0, length = elems.length; i < length; i++ ) { |
|
725 | retVal = !!callback( elems[ i ], i ); |
|
726 | if ( inv !== retVal ) { |
|
727 | ret.push( elems[ i ] ); |
|
728 | } |
|
729 | } |
|
730 | ||
731 | return ret; |
|
732 | }, |
|
733 | ||
734 | // arg is for internal usage only |
|
735 | map: function( elems, callback, arg ) { |