let func = function() {};
func.name
""
"func"
const http2 = require('http2'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const zlib = require('zlib'); | |
const brotli = require('brotli'); // npm package | |
const PORT = 3032; | |
const BROTLI_QUALITY = 11; // slow, but we're caching so who cares | |
const STATIC_DIRECTORY = path.resolve(__dirname, '../dist/'); | |
const cache = {}; |
//usage | |
withAdvice.call(targetObject); | |
//mixin augments target object with around, before and after methods | |
//method is the base method, advice is the augmenting function | |
withAdvice: function() { | |
['before', 'after', 'around'].forEach(function(m) { | |
this[m] = function(method, advice) { | |
if (typeof this[method] == 'function') { | |
return this[method] = fn[m](this[method], advice); |