{"version":3,"sources":["jsdelivr-header.js","/npm/fh-request-timer@1.0.1/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACNA,IAAI,IAAM,QAAQ,gBACd,UAAY,QAAQ,cAIxB,SAAS,eAAe,GACpB,IAAI,IAAc,IAAiC,IAAtB,EAAQ,WAErC,OAAO,SAAwB,EAAK,EAAK,GAErC,IAAI,EAAY,QAAQ,SACpB,EAAU,EAAI,KAElB,UAAU,GAAK,WACX,IAAI,EAAO,QAAQ,OAAO,GACtB,GAAkB,IAAV,EAAK,GAAW,EAAK,IAAM,IAEvC,IAAI,MAAM,OAAO,EAAS,GACtB,GACA,EAAI,OAAO,aAAc,EAAO,KAGxC,IACA,GAEJ,CACJ,CAvBA,QAAU,OAAO,QAAU","file":"/npm/fh-request-timer@1.0.1/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/fh-request-timer@1.0.1/index.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","var $fh = require('fh-mbaas-api'),\n    onHeaders = require('on-headers');\n\nexports = module.exports = fhRequestTimer;\n\nfunction fhRequestTimer(options) {\n    var addHeader = !(options && options.addHeader === false) && true;\n\n    return function fhRequestTimer(req, res, next) {\n\n        var startTime = process.hrtime(),\n            reqPath = req.path;\n\n        onHeaders(res, function getRequestTime() {\n            var diff = process.hrtime(startTime);\n            var time = (diff[0] * 1e9 + diff[1]) / 1e6;\n\n            $fh.stats.timing(reqPath, time);\n            if (addHeader) {\n                res.header(\"x-fh-timer\", time + \"ms\");\n            }\n\n        });\n        next();\n\n    }\n}\n"]}