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

Function bidirectionalIndexOf

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

Source from the content-addressed store, hash-verified

21702 ;((s[o] = s[i]), (s[i] = a))
21703 }
21704 function bidirectionalIndexOf(s, o, i, a, u) {
21705 if (0 === s.length) return -1
21706 if (
21707 ('string' == typeof i
21708 ? ((a = i), (i = 0))
21709 : i > 2147483647
21710 ? (i = 2147483647)
21711 : i < -2147483648 && (i = -2147483648),
21712 numberIsNaN((i = +i)) && (i = u ? 0 : s.length - 1),
21713 i < 0 && (i = s.length + i),
21714 i >= s.length)
21715 ) {
21716 if (u) return -1
21717 i = s.length - 1
21718 } else if (i < 0) {
21719 if (!u) return -1
21720 i = 0
21721 }
21722 if (('string' == typeof o && (o = Buffer.from(o, a)), Buffer.isBuffer(o)))
21723 return 0 === o.length ? -1 : arrayIndexOf(s, o, i, a, u)
21724 if ('number' == typeof o)
21725 return (
21726 (o &= 255),
21727 'function' == typeof Uint8Array.prototype.indexOf
21728 ? u
21729 ? Uint8Array.prototype.indexOf.call(s, o, i)
21730 : Uint8Array.prototype.lastIndexOf.call(s, o, i)
21731 : arrayIndexOf(s, [o], i, a, u)
21732 )
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,

Callers 1

Calls 3

numberIsNaNFunction · 0.85
arrayIndexOfFunction · 0.85
fromMethod · 0.45

Tested by

no test coverage detected