nl_tokens: @ngdoc method @name $q#all @kind function
pl_tokens: function all ( promises ) { var result = new Promise ( ) , counter = 0 , results = isArray ( promises ) ? [ ] : { } ; forEach ( promises , function ( promise , key ) { counter ++ ; when ( promise ) . then ( function ( value ) { results [ key ] = value ; if ( ! ( -- counter ) ) resolvePromise ( result , results ) ; } , function ( reason ) { rejectPromise ( result , reason ) ; } ) ; } ) ; if ( counter === 0 ) { resolvePromise ( result , <mask> ) ; } return result ; }