summaryrefslogtreecommitdiff
path: root/node_modules/locutus/php/var/is_callable.js.map
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/locutus/php/var/is_callable.js.map')
-rw-r--r--node_modules/locutus/php/var/is_callable.js.map1
1 files changed, 1 insertions, 0 deletions
diff --git a/node_modules/locutus/php/var/is_callable.js.map b/node_modules/locutus/php/var/is_callable.js.map
new file mode 100644
index 0000000..6c2fc21
--- /dev/null
+++ b/node_modules/locutus/php/var/is_callable.js.map
@@ -0,0 +1 @@
+{"version":3,"sources":["../../../src/php/var/is_callable.js"],"names":["module","exports","is_callable","mixedVar","syntaxOnly","callableName","$global","window","global","validJSFunctionNamePattern","name","obj","method","validFunctionName","getFuncName","fn","exec","match","Object","prototype","toString","call","length","constructor","eval"],"mappings":";;;;AAAAA,OAAOC,OAAP,GAAiB,SAASC,WAAT,CAAsBC,QAAtB,EAAgCC,UAAhC,EAA4CC,YAA5C,EAA0D;AAAE;AAC3E;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,UAAW,OAAOC,MAAP,KAAkB,WAAlB,GAAgCA,MAAhC,GAAyCC,MAAxD;;AAEA,MAAIC,6BAA6B,kDAAjC;;AAEA,MAAIC,OAAO,EAAX;AACA,MAAIC,MAAM,EAAV;AACA,MAAIC,SAAS,EAAb;AACA,MAAIC,oBAAoB,KAAxB;;AAEA,MAAIC,cAAc,SAAdA,WAAc,CAAUC,EAAV,EAAc;AAC9B,QAAIL,OAAQ,6BAAD,CAAgCM,IAAhC,CAAqCD,EAArC,CAAX;AACA,QAAI,CAACL,IAAL,EAAW;AACT,aAAO,aAAP;AACD;AACD,WAAOA,KAAK,CAAL,CAAP;AACD,GAND;;AAQA,MAAI,OAAOP,QAAP,KAAoB,QAAxB,EAAkC;AAChCQ,UAAML,OAAN;AACAM,aAAST,QAAT;AACAO,WAAOP,QAAP;AACAU,wBAAoB,CAAC,CAACH,KAAKO,KAAL,CAAWR,0BAAX,CAAtB;AACD,GALD,MAKO,IAAI,OAAON,QAAP,KAAoB,UAAxB,EAAoC;AACzC,WAAO,IAAP;AACD,GAFM,MAEA,IAAIe,OAAOC,SAAP,CAAiBC,QAAjB,CAA0BC,IAA1B,CAA+BlB,QAA/B,MAA6C,gBAA7C,IACTA,SAASmB,MAAT,KAAoB,CADX,IAET,QAAOnB,SAAS,CAAT,CAAP,MAAuB,QAFd,IAGT,OAAOA,SAAS,CAAT,CAAP,KAAuB,QAHlB,EAG4B;AACjCQ,UAAMR,SAAS,CAAT,CAAN;AACAS,aAAST,SAAS,CAAT,CAAT;AACAO,WAAO,CAACC,IAAIY,WAAJ,IAAmBT,YAAYH,IAAIY,WAAhB,CAApB,IAAoD,IAApD,GAA2DX,MAAlE;AACD,GAPM,MAOA;AACL,WAAO,KAAP;AACD;;AAED,MAAIR,cAAc,OAAOO,IAAIC,MAAJ,CAAP,KAAuB,UAAzC,EAAqD;AACnD,QAAIP,YAAJ,EAAkB;AAChBC,cAAQD,YAAR,IAAwBK,IAAxB;AACD;AACD,WAAO,IAAP;AACD;;AAED;AACA,MAAIG,qBAAqB,OAAOW,KAAKZ,MAAL,CAAP,KAAwB,UAAjD,EAA6D;AAAE;AAC7D,QAAIP,YAAJ,EAAkB;AAChBC,cAAQD,YAAR,IAAwBK,IAAxB;AACD;AACD,WAAO,IAAP;AACD;;AAED,SAAO,KAAP;AACD,CA/ED","file":"is_callable.js","sourcesContent":["module.exports = function is_callable (mixedVar, syntaxOnly, callableName) { // eslint-disable-line camelcase\n // discuss at: http://locutus.io/php/is_callable/\n // original by: Brett Zamir (http://brett-zamir.me)\n // input by: François\n // improved by: Brett Zamir (http://brett-zamir.me)\n // note 1: The variable callableName cannot work as a string variable passed by\n // note 1: reference as in PHP (since JavaScript does not support passing\n // note 1: strings by reference), but instead will take the name of\n // note 1: a global variable and set that instead.\n // note 1: When used on an object, depends on a constructor property\n // note 1: being kept on the object prototype\n // note 2: Depending on the `callableName` that is passed, this function can use eval.\n // note 2: The eval input is however checked to only allow valid function names,\n // note 2: So it should not be unsafer than uses without eval (seeing as you can)\n // note 2: already pass any function to be executed here.\n // example 1: is_callable('is_callable')\n // returns 1: true\n // example 2: is_callable('bogusFunction', true)\n // returns 2: true // gives true because does not do strict checking\n // example 3: function SomeClass () {}\n // example 3: SomeClass.prototype.someMethod = function (){}\n // example 3: var testObj = new SomeClass()\n // example 3: is_callable([testObj, 'someMethod'], true, 'myVar')\n // example 3: var $result = myVar\n // returns 3: 'SomeClass::someMethod'\n // example 4: is_callable(function () {})\n // returns 4: true\n\n var $global = (typeof window !== 'undefined' ? window : global)\n\n var validJSFunctionNamePattern = /^[_$a-zA-Z\\xA0-\\uFFFF][_$a-zA-Z0-9\\xA0-\\uFFFF]*$/\n\n var name = ''\n var obj = {}\n var method = ''\n var validFunctionName = false\n\n var getFuncName = function (fn) {\n var name = (/\\W*function\\s+([\\w$]+)\\s*\\(/).exec(fn)\n if (!name) {\n return '(Anonymous)'\n }\n return name[1]\n }\n\n if (typeof mixedVar === 'string') {\n obj = $global\n method = mixedVar\n name = mixedVar\n validFunctionName = !!name.match(validJSFunctionNamePattern)\n } else if (typeof mixedVar === 'function') {\n return true\n } else if (Object.prototype.toString.call(mixedVar) === '[object Array]' &&\n mixedVar.length === 2 &&\n typeof mixedVar[0] === 'object' &&\n typeof mixedVar[1] === 'string') {\n obj = mixedVar[0]\n method = mixedVar[1]\n name = (obj.constructor && getFuncName(obj.constructor)) + '::' + method\n } else {\n return false\n }\n\n if (syntaxOnly || typeof obj[method] === 'function') {\n if (callableName) {\n $global[callableName] = name\n }\n return true\n }\n\n // validFunctionName avoids exploits\n if (validFunctionName && typeof eval(method) === 'function') { // eslint-disable-line no-eval\n if (callableName) {\n $global[callableName] = name\n }\n return true\n }\n\n return false\n}\n"]} \ No newline at end of file