Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
throw new TypeError('HashMap.create() requires a \'hasher\' function and a \'hashBytes\' integer to use a custom \'hashAlg\'')
}
IAMap.registerHasher(hashAlg, hashBytes, hasher)
const bitWidth = fromOptions('bitWidth', 'number', DEFAULT_BITWIDTH)
const bucketSize = fromOptions('bucketSize', 'number', DEFAULT_BUCKET_SIZE)
const iamapOptions = { hashAlg, bitWidth, bucketSize }
let iamap
if (CID.isCID(root)) {
// load existing, ignoring bitWidth & bucketSize, they are loaded from the existing root
iamap = await IAMap.load(store, root)
} else {
// create new
iamap = await IAMap.create(store, iamapOptions)
}
return new HashMap(iamap)
}