nl_tokens: RSVP . filter is similar to JavaScript s native filter method except that it waits for all promises to become fulfilled before running the filterFn on each item in given to promises . RSVP . filter returns a promise that will become fulfilled with the result of running filterFn on the values the promises become fulfilled with .
pl_tokens: function filter ( promises , filterFn , <mask> ) { return all ( promises , label ) . then ( function ( values ) { if ( ! isArray ( promises ) ) { throw new TypeError ( 'You must pass an array to filter.' ) ; } if ( ! isFunction ( filterFn ) ) { throw new TypeError ( "You must pass a function to filter's second argument." ) ; } return map ( promises , filterFn , label ) . then ( function ( filterResults ) { var i , valuesLen = values . length , filtered = [ ] ; for ( i = 0 ; i < valuesLen ; i ++ ) { if ( filterResults [ i ] ) filtered . push ( values [ i ] ) ; } return filtered ; } ) ; } ) ; }