Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function maybeWasmSectionNameResolver(data: Uint8Array) {
try {
const parser = new BinaryReader();
parser.setData(data.buffer, 0, data.length);
const reader = new NameSectionReader();
reader.read(parser);
return reader.hasValidNames() ? reader.getNameResolver() : null;
} catch (ex) {
// Ignoring any errors during names section retrival.
return null;
}
}