1
|
{"version":3,"sources":["../../../src/php/strings/strrchr.js"],"names":["module","exports","strrchr","haystack","needle","pos","String","fromCharCode","parseInt","charAt","lastIndexOf","substr"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,OAAT,CAAkBC,QAAlB,EAA4BC,MAA5B,EAAoC;AACnD;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,MAAM,CAAV;;AAEA,MAAI,OAAOD,MAAP,KAAkB,QAAtB,EAAgC;AAC9BA,aAASE,OAAOC,YAAP,CAAoBC,SAASJ,MAAT,EAAiB,EAAjB,CAApB,CAAT;AACD;AACDA,WAASA,OAAOK,MAAP,CAAc,CAAd,CAAT;AACAJ,QAAMF,SAASO,WAAT,CAAqBN,MAArB,CAAN;AACA,MAAIC,QAAQ,CAAC,CAAb,EAAgB;AACd,WAAO,KAAP;AACD;;AAED,SAAOF,SAASQ,MAAT,CAAgBN,GAAhB,CAAP;AACD,CApBD","file":"strrchr.js","sourcesContent":["module.exports = function strrchr (haystack, needle) {\n // discuss at: http://locutus.io/php/strrchr/\n // original by: Brett Zamir (http://brett-zamir.me)\n // input by: Jason Wong (http://carrot.org/)\n // bugfixed by: Brett Zamir (http://brett-zamir.me)\n // example 1: strrchr(\"Line 1\\nLine 2\\nLine 3\", 10).substr(1)\n // returns 1: 'Line 3'\n\n var pos = 0\n\n if (typeof needle !== 'string') {\n needle = String.fromCharCode(parseInt(needle, 10))\n }\n needle = needle.charAt(0)\n pos = haystack.lastIndexOf(needle)\n if (pos === -1) {\n return false\n }\n\n return haystack.substr(pos)\n}\n"]}
|