Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

sourcemap-codec

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sourcemap-codec

Encode/decode sourcemap mappings

  • 1.3.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8M
decreased by-7.44%
Maintainers
1
Weekly downloads
 
Created

What is sourcemap-codec?

The sourcemap-codec npm package is designed for encoding and decoding mappings between original and generated code as represented in a source map. It provides efficient operations for working with the VLQ (Variable-Length Quantity) encoding used in source maps, making it easier to manipulate and understand the relationships between source and transformed code.

What are sourcemap-codec's main functionalities?

Encoding source map mappings

This feature allows you to encode an array of source map mappings into a compact string using VLQ encoding. The example demonstrates encoding mappings for two lines of code.

const { encode } = require('sourcemap-codec');
const mappings = [
  [ [ 0, 0, 0, 0 ], [ 1, 0, 1, 17 ] ], // First line mappings
  [ [ 0, 0, 1, 0 ] ] // Second line mappings
];
const encodedMappings = encode(mappings);

Decoding source map mappings

This feature enables the decoding of a VLQ-encoded string representing source map mappings back into a more understandable array format. The example shows how to decode a string into mappings for two lines.

const { decode } = require('sourcemap-codec');
const encodedMappings = 'AAAA,CAAC;AACA';
const mappings = decode(encodedMappings);

Other packages similar to sourcemap-codec

Keywords

FAQs

Package last updated on 20 Dec 2015

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc