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

Function from

frontend/public/swagger-ui-bundle.js:21536–21596  ·  view source on GitHub ↗
(s, o, i)

Source from the content-addressed store, hash-verified

21534 return from(s, o, i)
21535 }
21536 function from(s, o, i) {
21537 if ('string' == typeof s)
21538 return (function fromString(s, o) {
21539 ;('string' == typeof o && '' !== o) || (o = 'utf8')
21540 if (!Buffer.isEncoding(o)) throw new TypeError('Unknown encoding: ' + o)
21541 const i = 0 | byteLength(s, o)
21542 let a = createBuffer(i)
21543 const u = a.write(s, o)
21544 u !== i && (a = a.slice(0, u))
21545 return a
21546 })(s, o)
21547 if (ArrayBuffer.isView(s))
21548 return (function fromArrayView(s) {
21549 if (isInstance(s, Uint8Array)) {
21550 const o = new Uint8Array(s)
21551 return fromArrayBuffer(o.buffer, o.byteOffset, o.byteLength)
21552 }
21553 return fromArrayLike(s)
21554 })(s)
21555 if (null == s)
21556 throw new TypeError(
21557 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' +
21558 typeof s
21559 )
21560 if (isInstance(s, ArrayBuffer) || (s && isInstance(s.buffer, ArrayBuffer)))
21561 return fromArrayBuffer(s, o, i)
21562 if (
21563 'undefined' != typeof SharedArrayBuffer &&
21564 (isInstance(s, SharedArrayBuffer) || (s && isInstance(s.buffer, SharedArrayBuffer)))
21565 )
21566 return fromArrayBuffer(s, o, i)
21567 if ('number' == typeof s)
21568 throw new TypeError(
21569 'The "value" argument must not be of type number. Received type number'
21570 )
21571 const a = s.valueOf && s.valueOf()
21572 if (null != a && a !== s) return Buffer.from(a, o, i)
21573 const u = (function fromObject(s) {
21574 if (Buffer.isBuffer(s)) {
21575 const o = 0 | checked(s.length),
21576 i = createBuffer(o)
21577 return (0 === i.length || s.copy(i, 0, 0, o), i)
21578 }
21579 if (void 0 !== s.length)
21580 return 'number' != typeof s.length || numberIsNaN(s.length)
21581 ? createBuffer(0)
21582 : fromArrayLike(s)
21583 if ('Buffer' === s.type && Array.isArray(s.data)) return fromArrayLike(s.data)
21584 })(s)
21585 if (u) return u
21586 if (
21587 'undefined' != typeof Symbol &&
21588 null != Symbol.toPrimitive &&
21589 'function' == typeof s[Symbol.toPrimitive]
21590 )
21591 return Buffer.from(s[Symbol.toPrimitive]('string'), o, i)
21592 throw new TypeError(
21593 'The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' +

Callers 2

BufferFunction · 0.85

Calls 10

byteLengthFunction · 0.85
createBufferFunction · 0.85
isInstanceFunction · 0.85
fromArrayBufferFunction · 0.85
fromArrayLikeFunction · 0.85
checkedFunction · 0.85
numberIsNaNFunction · 0.85
valueOfMethod · 0.80
fromMethod · 0.45
isArrayMethod · 0.45

Tested by

no test coverage detected