MCPcopy Index your code
hub / github.com/dataease/SQLBot / arrayIndexOf

Function arrayIndexOf

frontend/public/swagger-ui-bundle.js:21735–21770  ·  view source on GitHub ↗
(s, o, i, a, u)

Source from the content-addressed store, hash-verified

21733 throw new TypeError('val must be string, number or Buffer')
21734 }
21735 function arrayIndexOf(s, o, i, a, u) {
21736 let _,
21737 w = 1,
21738 x = s.length,
21739 C = o.length
21740 if (
21741 void 0 !== a &&
21742 ('ucs2' === (a = String(a).toLowerCase()) ||
21743 'ucs-2' === a ||
21744 'utf16le' === a ||
21745 'utf-16le' === a)
21746 ) {
21747 if (s.length < 2 || o.length < 2) return -1
21748 ;((w = 2), (x /= 2), (C /= 2), (i /= 2))
21749 }
21750 function read(s, o) {
21751 return 1 === w ? s[o] : s.readUInt16BE(o * w)
21752 }
21753 if (u) {
21754 let a = -1
21755 for (_ = i; _ < x; _++)
21756 if (read(s, _) === read(o, -1 === a ? 0 : _ - a)) {
21757 if ((-1 === a && (a = _), _ - a + 1 === C)) return a * w
21758 } else (-1 !== a && (_ -= _ - a), (a = -1))
21759 } else
21760 for (i + C > x && (i = x - C), _ = i; _ >= 0; _--) {
21761 let i = !0
21762 for (let a = 0; a < C; a++)
21763 if (read(s, _ + a) !== read(o, a)) {
21764 i = !1
21765 break
21766 }
21767 if (i) return _
21768 }
21769 return -1
21770 }
21771 function hexWrite(s, o, i, a) {
21772 i = Number(i) || 0
21773 const u = s.length - i

Callers 1

bidirectionalIndexOfFunction · 0.85

Calls 1

readFunction · 0.85

Tested by

no test coverage detected