summaryrefslogtreecommitdiff
path: root/node_modules/locutus/php/strings/stristr.js.map
blob: 3231c6191c4e857bc0259172e46a9430bf337fb9 (plain) (blame)
1
{"version":3,"sources":["../../../src/php/strings/stristr.js"],"names":["module","exports","stristr","haystack","needle","bool","pos","toLowerCase","indexOf","substr","slice"],"mappings":";;AAAAA,OAAOC,OAAP,GAAiB,SAASC,OAAT,CAAkBC,QAAlB,EAA4BC,MAA5B,EAAoCC,IAApC,EAA0C;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,MAAIC,MAAM,CAAV;;AAEAH,cAAY,EAAZ;AACAG,QAAMH,SAASI,WAAT,GACHC,OADG,CACK,CAACJ,SAAS,EAAV,EACNG,WADM,EADL,CAAN;AAGA,MAAID,QAAQ,CAAC,CAAb,EAAgB;AACd,WAAO,KAAP;AACD,GAFD,MAEO;AACL,QAAID,IAAJ,EAAU;AACR,aAAOF,SAASM,MAAT,CAAgB,CAAhB,EAAmBH,GAAnB,CAAP;AACD,KAFD,MAEO;AACL,aAAOH,SAASO,KAAT,CAAeJ,GAAf,CAAP;AACD;AACF;AACF,CAxBD","file":"stristr.js","sourcesContent":["module.exports = function stristr (haystack, needle, bool) {\n  //  discuss at: http://locutus.io/php/stristr/\n  // original by: Kevin van Zonneveld (http://kvz.io)\n  // bugfixed by: Onno Marsman (https://twitter.com/onnomarsman)\n  //   example 1: stristr('Kevin van Zonneveld', 'Van')\n  //   returns 1: 'van Zonneveld'\n  //   example 2: stristr('Kevin van Zonneveld', 'VAN', true)\n  //   returns 2: 'Kevin '\n\n  var pos = 0\n\n  haystack += ''\n  pos = haystack.toLowerCase()\n    .indexOf((needle + '')\n      .toLowerCase())\n  if (pos === -1) {\n    return false\n  } else {\n    if (bool) {\n      return haystack.substr(0, pos)\n    } else {\n      return haystack.slice(pos)\n    }\n  }\n}\n"]}