Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
exports.unmarshal = (input, opts) => {
opts = defaults(opts || {}, {
encoding: cborUtils.guessEncoding(input)
})
const dec = new cbor.Decoder(opts)
const bs = new NoFilter()
dec.pipe(bs)
dec.end(input, opts.encoding)
const res = bs.read()
function transform (obj) {
Object.keys(obj).forEach((key) => {
const val = obj[key]
// This is safe as we reference the same cbor instance
// as we used to decode with
if (val instanceof cbor.Tagged) {
if (typeof val.value === 'string') {
obj[key] = {
[LINK_SYMBOL]: val.value