
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
@types/convert-source-map
Advanced tools
TypeScript definitions for convert-source-map
@types/convert-source-map provides TypeScript type definitions for the convert-source-map package, which is used to convert between different formats of source maps, such as from inline to external and vice versa.
Converting Inline Source Map to Object
This feature allows you to convert an inline source map (embedded in a comment) to a source map object.
const convert = require('convert-source-map');
const inlineSourceMap = '//# sourceMappingURL=data:application/json;base64,...';
const sm = convert.fromComment(inlineSourceMap);
console.log(sm.toObject());
Converting Source Map Object to JSON
This feature allows you to convert a source map object to a JSON string.
const convert = require('convert-source-map');
const sm = convert.fromObject({ version: 3, file: 'out.js', sources: ['foo.js'], names: [], mappings: 'AAAA' });
console.log(sm.toJSON());
Adding Source Map Comment to File
This feature allows you to add a source map comment to a file's content.
const convert = require('convert-source-map');
const sm = convert.fromObject({ version: 3, file: 'out.js', sources: ['foo.js'], names: [], mappings: 'AAAA' });
const fileContent = 'console.log("Hello World");';
const fileWithSourceMap = fileContent + '\n' + sm.toComment();
console.log(fileWithSourceMap);
The source-map package provides a library for generating and consuming source maps. It offers more comprehensive functionalities for working with source maps, including parsing, generating, and manipulating them. It is more feature-rich compared to convert-source-map.
The inline-source-map package is a simpler alternative that focuses on generating inline source maps. It is less comprehensive than convert-source-map but can be useful for projects that only need to work with inline source maps.
npm install --save @types/convert-source-map
This package contains type definitions for convert-source-map (https://github.com/thlorenz/convert-source-map).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/convert-source-map.
These definitions were written by Andrew Gaspar, Melvin Groenhoff, and TeamworkGuy2.
FAQs
TypeScript definitions for convert-source-map
We found that @types/convert-source-map demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.