Created
January 14, 2014 07:18
-
-
Save yasakbulut/8414421 to your computer and use it in GitHub Desktop.
Calculates the average response time (in milliseconds) for requests made to an URL containing a specified keyword, given an object containing HAR (Http ARchive) data.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function getAvgResponseTimeForURL(har, keyword){ | |
| har.log.entries.filter(function(a){return a.request.url.indexOf(keyword)!=-1}).map(function(a){ return a.time}).reduce(function(previousValue, currentValue, index, array){return previousValue + (currentValue / array.length);},0); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usage: