{"version":3,"sources":["jsdelivr-header.js","/npm/olical-binary-search@1.0.0/src/binarySearch.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,ACCA,SAAS,aAAa,EAAM,GACxB,IAEI,EAFA,EAAM,EACN,EAAM,EAAK,OAAS,EAI3B,GADe,GAAO,WAErB,KAAO,GAAO,GAAK,CAElB,GAAI,EADJ,EAAS,EAAM,GAAQ,KACH,EAAQ,OAAO,EAE9B,EAAK,GAAS,EAAQ,EAAM,EAAQ,EACjC,EAAM,EAAQ,CAEvB,MAEA,KAAO,GAAO,GAAK,CAElB,GAAI,EADJ,EAAQ,KAAK,OAAO,EAAM,GAAO,MACb,EAAQ,OAAO,EAE9B,EAAK,GAAS,EAAQ,EAAM,EAAQ,EACjC,EAAM,EAAQ,CAEvB,CAGE,OAAQ,CACZ,CAEA,OAAO,QAAU","file":"/npm/olical-binary-search@1.0.0/src/binarySearch.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/olical-binary-search@1.0.0/src/binarySearch.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","/**\n * Performs a binary search on the provided sorted list and returns the index of the item if found. If it can't be found it'll return -1.\n *\n * @param {*[]} list Items to search through.\n * @param {*} item The item to look for.\n * @return {Number} The index of the item if found, -1 if not.\n */\nfunction binarySearch(list, item) {\n    var min = 0;\n    var max = list.length - 1;\n    var guess;\n\n\tvar bitwise = (max <= 2147483647) ? true : false;\n\tif (bitwise) {\n\t\twhile (min <= max) {\n\t\t\tguess = (min + max) >> 1;\n\t\t\tif (list[guess] === item) { return guess; }\n\t\t\telse {\n\t\t\t\tif (list[guess] < item) { min = guess + 1; }\n\t\t\t\telse { max = guess - 1; }\n\t\t\t}\n\t\t}\n\t} else {\n\t\twhile (min <= max) {\n\t\t\tguess = Math.floor((min + max) / 2);\n\t\t\tif (list[guess] === item) { return guess; }\n\t\t\telse {\n\t\t\t\tif (list[guess] < item) { min = guess + 1; }\n\t\t\t\telse { max = guess - 1; }\n\t\t\t}\n\t\t}\n\t}\n\n    return -1;\n}\n\nmodule.exports = binarySearch;\n"]}