MCPcopy Create free account
hub / github.com/bitpay/bitcore-message / from

Function from

bitcore-message.js:414–428  ·  view source on GitHub ↗
(that, value, encodingOrOffset, length)

Source from the content-addressed store, hash-verified

412}
413
414function from (that, value, encodingOrOffset, length) {
415 if (typeof value === 'number') {
416 throw new TypeError('"value" argument must not be a number')
417 }
418
419 if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
420 return fromArrayBuffer(that, value, encodingOrOffset, length)
421 }
422
423 if (typeof value === 'string') {
424 return fromString(that, value, encodingOrOffset)
425 }
426
427 return fromObject(that, value)
428}
429
430/**
431 * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError

Callers 2

BufferFunction · 0.85
bitcore-message.jsFile · 0.85

Calls 3

fromArrayBufferFunction · 0.85
fromStringFunction · 0.85
fromObjectFunction · 0.85

Tested by

no test coverage detected