{"version":3,"sources":["jsdelivr-header.js","/npm/stick-to-this@0.0.3/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACHA,aACA,IAAI,QAAU,qCACV,eAAiB,mCACjB,aAAe,yDAEnB,SAAS,kBAAmB,GAExB,OADa,EAAG,WAAW,QAAQ,eAAgB,IACrC,MAAM,QACxB,CAEA,SAAS,MAAM,EAAS,GACpB,IAAI,EAAU,EACV,EAAU,kBAAkB,GAC5B,EAAS,EAAQ,GACjB,EAAS,EAAQ,GAAI,EAAQ,GAAG,MAAM,KAAO,GAC7C,EAAY,aACX,QAAQ,SAAU,EAAO,KAAK,MAC9B,QAAQ,SAAU,GAClB,QAAQ,UAAW,SAGxB,OAFA,EAAO,KAAK,GACK,SAAS,MAAM,KAAM,GAAQ,KAAK,EAC5C,EACX,CAEA,OAAO,QAAU","file":"/npm/stick-to-this@0.0.3/index.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/stick-to-this@0.0.3/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","/* This work is distributed under MIT license, and is utilizes modified codes\nfrom another work here:  https://github.com/btford/fn-params\n* */\n'use strict';\nvar FN_ARGS = /^function\\s*[^\\(]*\\(\\s*([^\\)]*)\\)/m;\nvar STRIP_COMMENTS = /((\\/\\/.*$)|(\\/\\*[\\s\\S]*?\\*\\/))/mg;\nvar bodyTemplate = ' var {alias} = this; return function ({args}){body};\\n';\n\nfunction getFunctionParams (fn) {\n    var fnText = fn.toString().replace(STRIP_COMMENTS, '');\n    return fnText.split(FN_ARGS);\n}\n\nfunction stick(thisObj, fn){\n    var context = thisObj;\n    var fnParts = getFunctionParams(fn);\n    var fnBody = fnParts[2];\n    var fnArgs = fnParts[1]? fnParts[1].split(',') : [];\n    var proxyBody = bodyTemplate\n        .replace('{args}', fnArgs.join(','))\n        .replace('{body}', fnBody)\n        .replace('{alias}', '_this');\n    fnArgs.push(proxyBody);\n    var proxyMaker = Function.apply(null, fnArgs).bind(context);\n    return proxyMaker();\n}\n\nmodule.exports = stick;\n"]}